/* Ma'at Editor web interface - mobile first, scaled up at 768px. */

:root {
    --royal-black: #0E0E0E;
    --ethiopian-gold: #C6A64F;
    --earth-brown: #5A3E2B;
    --bone-white: #F4F1EC;
    --deep-olive: #3E4A2C;
    --oxide-red: #7A2E2A;
    --bg: #F4F1EC;
    --text: #0E0E0E;
    --accent: #C6A64F;
    --success: #3E4A2C;
    --warning: #C6A64F;
    --error: #7A2E2A;
    --border: #d4d0c8;
    --card-bg: #ffffff;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
}

a { color: var(--earth-brown); }

/* Top navigation bar */
.navbar {
    background: var(--royal-black);
    color: var(--bone-white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 10px;
}

.navbar h1 { font-size: 18px; font-weight: 600; margin: 0; }
.navbar h1 a { color: var(--ethiopian-gold); text-decoration: none; }

.navbar .status-pill {
    background: var(--ethiopian-gold);
    color: var(--royal-black);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.subnav {
    display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px;
    background: #1b1b1b; position: sticky; top: 52px; z-index: 99;
}
.subnav a {
    color: var(--bone-white); text-decoration: none; font-size: 14px;
    padding: 6px 12px; border-radius: 14px; white-space: nowrap;
    background: #2a2a2a;
}
.subnav a.active { background: var(--ethiopian-gold); color: var(--royal-black); }

main { padding: 16px; max-width: 900px; margin: 0 auto; }

h2 { font-size: 20px; margin: 4px 0 14px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { opacity: .7; font-size: 14px; }

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}
.card.blocking { border-left: 5px solid var(--error); }
.card.warning  { border-left: 5px solid var(--warning); }
.card.passed   { border-left: 5px solid var(--success); }
.card a.stretch { text-decoration: none; color: inherit; display: block; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Action buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
    width: 100%;
    margin-bottom: 8px;
    font-family: inherit;
    text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-approve { background: var(--success); color: #fff; }
.btn-reject  { background: var(--error); color: #fff; }
.btn-edit    { background: var(--accent); color: var(--royal-black); }
.btn-rewrite { background: var(--border); color: var(--text); }
.btn-primary { background: var(--royal-black); color: var(--bone-white); }

.btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-group .btn { margin-bottom: 0; }

@media (min-width: 768px) {
    .btn { width: auto; margin-right: 8px; }
    .btn-group { display: flex; gap: 8px; }
    .btn-group .btn { flex: 1; }
}

/* Diff display */
.diff-original {
    background: #fde8e8;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.diff-suggested {
    background: #e8fde8;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.label {
    font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
    opacity: .65; margin: 8px 0 4px;
}

.marker {
    font-size: 12px; font-weight: 600; letter-spacing: .06em;
    color: var(--earth-brown); border: 1px solid var(--border);
    border-radius: 4px; padding: 2px 8px; white-space: nowrap;
}

.warn-note {
    margin-top: 10px; padding: 9px 12px; border-radius: 6px; font-size: 14px;
    background: rgba(198,166,79,.2); border-left: 3px solid var(--accent);
}

/* Progress grid */
.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table th, .grid-table td {
    border: 1px solid var(--border); padding: 6px 4px; text-align: center;
}
.grid-table th { background: #e9e5dd; font-size: 11px; }
.cell-approved { background: var(--success); color: #fff; }
.cell-pending  { background: var(--accent); color: var(--royal-black); }
.cell-error    { background: var(--error); color: #fff; }
.cell-not-started { background: var(--border); color: #555; }

.desktop-only { display: none; }
@media (min-width: 768px) {
    .desktop-only { display: block; }
    .mobile-only { display: none; }
}

/* Progress grid dots (mobile) */
.pass-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.pass-dot.approved { background: var(--success); }
.pass-dot.pending { background: var(--accent); }
.pass-dot.error { background: var(--error); }
.pass-dot.not-started { background: var(--border); }

/* Edit textarea */
.edit-textarea {
    width: 100%;
    min-height: 100px;
    font-size: 16px;
    line-height: 1.6;
    padding: 12px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

input[type=text], select {
    width: 100%; font-size: 16px; padding: 12px; border-radius: 6px;
    border: 1px solid var(--border); font-family: inherit; min-height: 48px;
    background: #fff; color: var(--text);
}
label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0 4px; }

/* Fixed bottom bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
}
.bottom-bar .summary { font-size: 14px; text-align: center; margin-bottom: 8px; }

.content-with-bottom-bar { padding-bottom: 150px; }

/* Status + spinner */
.badge {
    font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 10px;
    white-space: nowrap;
}
.badge.approved { background: var(--success); color: #fff; }
.badge.pending_review, .badge.in_progress { background: var(--accent); color: var(--royal-black); }
.badge.not_started { background: var(--border); color: #555; }
.badge.skipped { background: #ccc; color: #555; }

.spinner {
    display: inline-block; width: 18px; height: 18px; vertical-align: -3px;
    border: 3px solid rgba(0,0,0,.15); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed; left: 16px; right: 16px; bottom: 90px; z-index: 200;
    background: var(--royal-black); color: var(--bone-white);
    padding: 12px 16px; border-radius: 8px; font-size: 15px; display: none;
}
.toast.show { display: block; }

.nav-arrows { display: flex; gap: 8px; }
.nav-arrows .btn { width: auto; flex: 1; }
