:root {
    --bg: #f5f5f0;
    --surface: #ffffff;
    --border: #d4d0c8;
    --border-light: #e8e5de;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-dim: #999;
    --accent: #2c5282;
    --accent-light: #ebf2ff;
    --green: #276749;
    --green-bg: #f0fff4;
    --green-border: #c6f6d5;
    --yellow: #975a16;
    --yellow-bg: #fefce8;
    --yellow-border: #fef08a;
    --red: #9b2c2c;
    --red-bg: #fff5f5;
    --red-border: #fed7d7;
    --blue: #2b6cb0;
    --blue-bg: #ebf8ff;
    --blue-border: #bee3f8;
    --orange: #c05621;
    --radius: 4px;
    --edited-bg: #fffde7;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5;
}
.navbar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 48px; display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand { font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
.navbar-brand span { color: var(--accent); }
.navbar-links { display: flex; align-items: center; gap: 16px; }
.navbar-links a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.navbar-links a:hover { color: var(--text); }
.login-container {
    max-width: 360px; margin: 120px auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 32px;
}
.login-container h2 { font-size: 18px; margin-bottom: 4px; }
.login-container .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 600; color: var(--text-muted);
    margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em;
}
.form-group input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 14px; outline: none;
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(44,82,130,0.15); }
.error-msg {
    background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red);
    padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px;
    font-size: 13px; font-weight: 500; border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer; background: var(--surface);
    color: var(--text); text-decoration: none; transition: background 0.15s;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1e4d78; }
.btn-approve { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.btn-approve:hover { background: #dcfce7; }
.btn-save { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-border); }
.btn-save:hover { background: #fef9c3; }
.btn-reject { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.btn-reject:hover { background: #fee2e2; }
.btn-undo {
    background: var(--surface); color: var(--text-muted); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 3px 10px; font-size: 11px; cursor: pointer;
    font-weight: 500;
}
.btn-undo:hover { background: var(--bg); color: var(--text); }
.btn-block { width: 100%; justify-content: center; }
.btn-inline {
    background: none; border: 1px solid var(--border-light); border-radius: var(--radius);
    padding: 2px 8px; font-size: 11px; color: var(--accent); cursor: pointer;
    margin-left: 8px; font-weight: 500;
}
.btn-inline:hover { background: var(--accent-light); }
.btn-remove {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    font-size: 14px; padding: 2px 4px; line-height: 1;
}
.btn-remove:hover { color: var(--red); }
.page-header { padding: 20px 24px 16px; }
.page-header h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-header .subtitle { font-size: 13px; color: var(--text-muted); }
.status-cards { display: flex; gap: 12px; padding: 0 24px 16px; flex-wrap: wrap; }
.status-card {
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 12px 20px; min-width: 120px;
    text-align: center; text-decoration: none; color: inherit; transition: border-color 0.15s;
}
.status-card:hover { border-color: var(--accent); }
.status-card .count { font-size: 28px; font-weight: 700; line-height: 1.2; }
.status-card .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.status-card.pending .count { color: var(--orange); }
.status-card.saved .count { color: var(--blue); }
.status-card.approved .count { color: var(--green); }
.status-card.rejected .count { color: var(--red); }
.queue-filters { display: flex; gap: 12px; padding: 0 24px 12px; align-items: center; flex-wrap: wrap; }
.queue-filters select, .queue-filters input[type="text"] {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; background: var(--surface); outline: none;
}
.queue-filters select:focus, .queue-filters input:focus { border-color: var(--accent); }
.queue-table-wrap { padding: 0 24px 24px; }
.queue-table {
    width: 100%; background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden;
}
.queue-table th {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); background: #fafaf7; padding: 8px 12px; text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.queue-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.queue-table tr:last-child td { border-bottom: none; }
.queue-table tr:hover td { background: #fafaf7; }
.queue-table tr { cursor: pointer; }
.status-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.status-badge.pending { background: #fff7ed; color: var(--orange); }
.status-badge.saved { background: var(--blue-bg); color: var(--blue); }
.status-badge.approved { background: var(--green-bg); color: var(--green); }
.status-badge.rejected { background: var(--red-bg); color: var(--red); }
.pagination {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; font-size: 13px; color: var(--text-muted);
}
.review-header {
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.review-header .title { font-size: 16px; font-weight: 700; }
.review-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }
.review-meta .tag {
    padding: 2px 8px; background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius);
}
.review-panels { display: flex; height: calc(100vh - 48px - 56px - 52px - 120px); min-height: 400px; }
.panel { flex: 1; overflow-y: auto; padding: 0; }
.panel-left { border-right: 1px solid var(--border); }
.panel-left iframe { width: 100%; height: 100%; border: none; }
.panel-header {
    position: sticky; top: 0; background: #fafaf7; padding: 8px 16px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); border-bottom: 1px solid var(--border-light); z-index: 1;
}
.data-section { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.data-section h3 {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); margin-bottom: 8px;
}
.data-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; }
.data-row .label { color: var(--text-muted); flex-shrink: 0; margin-right: 12px; min-width: 140px; }
.data-row .value { font-weight: 500; text-align: right; word-break: break-word; }
.data-row .value.null { color: var(--text-dim); font-style: italic; font-weight: 400; }

/* Editable field styles */
.edit-field {
    flex: 1; padding: 4px 8px; border: 1px solid var(--border-light);
    border-radius: var(--radius); font-size: 13px; font-family: inherit;
    background: var(--surface); color: var(--text); outline: none;
    max-width: 280px; text-align: right;
}
.edit-field:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(44,82,130,0.1); }
.edit-field.edited { background: var(--edited-bg); border-color: #f0c000; }
.edit-field[name="denomination"] { text-align: left; max-width: 160px; }
.edit-field[type="date"] { max-width: 180px; }
.edit-field[type="checkbox"] { max-width: 20px; }
.edit-textarea {
    width: 100%; max-width: 100%; min-height: 48px; resize: vertical;
    text-align: left; padding: 6px 8px; font-size: 12px; line-height: 1.5;
}
.edit-number { font-variant-numeric: tabular-nums; }
.checkbox-wrap { display: flex; align-items: center; }

/* Cell inputs inside tables */
.cell-input {
    width: 100%; padding: 3px 6px; border: 1px solid transparent;
    border-radius: 2px; font-size: 12px; font-family: inherit;
    background: transparent; color: var(--text); outline: none;
}
.cell-input:hover { border-color: var(--border-light); }
.cell-input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 1px rgba(44,82,130,0.1); }
.cell-input.edited { background: var(--edited-bg); }
.cell-number { text-align: right; font-variant-numeric: tabular-nums; }

.intangibles-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.intangibles-table th {
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-dim); padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--border-light);
}
.intangibles-table td { padding: 2px 2px; border-bottom: 1px solid var(--border-light); }
.intangibles-table td.number { text-align: right; font-variant-numeric: tabular-nums; }
.intangible-row.new-row { background: #f0fff4; }

/* Contingent consideration cards */
.contingent-card {
    border: 1px solid var(--border-light); border-radius: var(--radius);
    padding: 8px 10px; margin-bottom: 8px; font-size: 12px; position: relative;
}
.contingent-card.new-row { background: #f0fff4; }
.contingent-card .data-row { padding: 2px 0; }
.contingent-card .label { min-width: 100px; }
.contingent-remove { position: absolute; top: 6px; right: 6px; }

.review-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 24px; }
.notes-row { margin-bottom: 12px; }
.notes-row label {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); display: block; margin-bottom: 4px;
}
.notes-row textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; font-family: inherit; resize: vertical; min-height: 48px; outline: none;
}
.notes-row textarea:focus { border-color: var(--accent); }
.actions-row { display: flex; justify-content: space-between; align-items: center; }
.actions-left { display: flex; gap: 8px; }
.actions-right { display: flex; gap: 8px; }
.desc-block {
    font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-top: 4px;
    padding: 6px 8px; background: #fafaf7; border-radius: var(--radius);
    max-height: 120px; overflow-y: auto;
}
.validation-line { font-size: 12px; padding: 6px 8px; border-radius: var(--radius); margin-top: 8px; }
.validation-line.ok { background: var(--green-bg); color: var(--green); }
.validation-line.warn { background: var(--yellow-bg); color: var(--yellow); }
.flash { margin: 12px 24px; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; }
.flash.success { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.flash.error { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); }
.flash.info { background: var(--blue-bg); border: 1px solid var(--blue-border); color: var(--blue); }
.sec-link { font-size: 12px; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.sec-link:hover { text-decoration: underline; }
@media (max-width: 900px) {
    .review-panels { flex-direction: column; height: auto; }
    .panel-left { border-right: none; border-bottom: 1px solid var(--border); min-height: 300px; }
    .panel { min-height: 300px; }
}
