/* AWEL Document Review Tool – Swiss/utilitarian design */

:root {
    --bg:       #f5f5f3;
    --bg-card:  #ffffff;
    --border:   #d4d4d0;
    --text:     #1a1a1a;
    --text-sec: #555;
    --primary:  #0050a0;
    --green:    #1a7a3a;
    --orange:   #c44b00;
    --yellow:   #b8860b;
    --radius:   4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
    background: #fff;
    border-bottom: 2px solid var(--primary);
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.header h1 span { color: var(--primary); }
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-sec);
}
.header-right a { font-size: 13px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #003d7a; }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { background: #145e2c; }
.btn-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-orange:hover { background: #9a3b00; }
.btn-sm { padding: 3px 8px; font-size: 12px; }

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.stat-num {
    font-size: 22px;
    font-weight: 600;
}
.stat-label {
    font-size: 12px;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Container */
.container { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* Action bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* Document table */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.doc-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-sec);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.doc-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}
.doc-table tr:last-child td { border-bottom: none; }
.doc-table tr:hover { background: #fafaf8; }
.doc-table .clickable { cursor: pointer; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-pending { background: #e8e8e4; color: #555; }
.badge-approved { background: #d4edda; color: var(--green); }
.badge-flagged { background: #fde0d0; color: var(--orange); }

/* Login page */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 340px;
}
.login-box h2 {
    font-size: 18px;
    margin-bottom: 4px;
}
.login-box .subtitle {
    font-size: 12px;
    color: var(--text-sec);
    margin-bottom: 24px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 80, 160, 0.1);
}
.error-msg {
    color: var(--orange);
    font-size: 13px;
    margin-bottom: 12px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}
.modal h3 { font-size: 16px; margin-bottom: 20px; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ===== Review page ===== */
.review-layout {
    display: flex;
    height: calc(100vh - 49px);
}

/* PDF panel */
.pdf-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #525659;
    min-width: 0;
}
.pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #3b3e42;
    color: #ccc;
    font-size: 13px;
    flex-shrink: 0;
}
.pdf-toolbar button {
    background: #555;
    color: #ddd;
    border: none;
    border-radius: 3px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
}
.pdf-toolbar button:hover { background: #666; }
.pdf-canvas-wrap {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 12px;
}
.pdf-canvas-wrap canvas {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* Form panel */
.form-panel {
    width: 480px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #fff;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.form-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.form-header h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.form-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-sec);
}
.form-meta .meta-item { display: flex; gap: 4px; }

.form-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Section headers in form */
.section-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0dc;
}
.section-header:first-child { margin-top: 0; }

/* Field rows */
.field-row {
    display: flex;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0ec;
    gap: 8px;
}
.field-row:hover { background: #fafaf8; }
.field-row:hover .flag-btns { opacity: 1; }

.field-label {
    width: 200px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-sec);
    padding-top: 2px;
}
.field-value {
    flex: 1;
    font-size: 13px;
    word-break: break-word;
}
.field-value.null-val {
    color: #999;
    font-style: italic;
}
.field-value.bool-yes { color: var(--green); }
.field-value.bool-no { color: var(--text-sec); }

/* Flag buttons */
.flag-btns {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.field-row.has-flag .flag-btns { opacity: 1; }

.flag-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.flag-btn:hover { background: #f0f0ec; }
.flag-btn.active-ok { background: #d4edda; border-color: var(--green); color: var(--green); }
.flag-btn.active-uncertain { background: #fff3cd; border-color: var(--yellow); color: var(--yellow); }
.flag-btn.active-incorrect { background: #fde0d0; border-color: var(--orange); color: var(--orange); }

/* Field highlight based on flag */
.field-row.flag-ok { background: #f0faf2; }
.field-row.flag-uncertain { background: #fefbef; }
.field-row.flag-incorrect { background: #fef4ee; }

.flag-comment {
    font-size: 11px;
    color: var(--text-sec);
    font-style: italic;
    margin-top: 2px;
}

/* Missing fields */
.field-row.flag-missing { background: #fef4ee; }
.missing-input {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
}
.missing-input:focus {
    outline: none;
    border-color: var(--primary);
}
.add-missing-row {
    padding: 2px 0 8px;
}
.btn-add-missing {
    background: none;
    border: 1px dashed #ccc;
    border-radius: 3px;
    color: var(--text-sec);
    font-size: 11px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
}
.btn-add-missing:hover {
    border-color: var(--orange);
    color: var(--orange);
}
.add-missing-general { margin-top: 20px; }

/* Form footer */
.form-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.form-footer .notes-area {
    width: 100%;
    min-height: 60px;
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}
.form-footer .submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-btns {
    display: flex;
    gap: 8px;
}

/* Responsive: stack on narrow screens */
@media (max-width: 900px) {
    .review-layout { flex-direction: column; height: auto; }
    .pdf-panel { height: 50vh; }
    .form-panel { width: 100%; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-sec);
}
.empty-state p { font-size: 15px; margin-bottom: 8px; }
