:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #e7e9ee;
  --line-strong: #d9dde6;
  --text: #1f2430;
  --muted: #6b7280;
  --soft: #f2f4f7;
  --accent: #5b5bd6;
  --accent-soft: #eeefff;
  --green: #198754;
  --amber: #b7791f;
  --red: #c33c54;
  --shadow: 0 10px 28px rgba(25, 30, 45, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.app-shell { padding: 24px; min-width: 1180px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1 { font-size: 26px; margin: 4px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 20px; line-height: 1.25; margin: 4px 0 0; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.source-badge { border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 10px; background: white; font-size: 12px; color: var(--muted); }
.source-badge.live { color: var(--green); border-color: #b8ddca; background: #f1fbf6; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 2px rgba(20,24,35,.02); }
.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 1px solid transparent; border-radius: 7px; min-height: 34px; padding: 0 12px; font-size: 13px; font-weight: 650; }
.button.secondary { background: white; border-color: var(--line-strong); color: var(--text); }
.button.primary { background: var(--accent); color: white; }
.button:disabled { opacity: .55; cursor: wait; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 750; letter-spacing: .045em; }
.kpi .value { font-size: 24px; font-weight: 760; letter-spacing: -.025em; margin-top: 4px; }
.kpi .hint { color: var(--muted); font-size: 11px; margin-top: 3px; }
.toolbar { padding: 9px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar select, .toolbar input { border: 1px solid var(--line-strong); background: white; height: 34px; border-radius: 7px; color: var(--text); }
.toolbar select { padding: 0 30px 0 9px; max-width: 250px; }
.search-wrap { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 7px; height: 34px; padding: 0 9px; background: white; }
.search-wrap input { border: 0; outline: 0; height: 30px; width: 100%; min-width: 0; }
.search-wrap span { color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.link-button { border: 0; background: transparent; color: var(--accent); font-size: 12px; padding: 7px; }
.table-card { overflow: hidden; }
.table-headline { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.table-headline .muted { margin-left: 8px; }
.muted { color: var(--muted); }
.legend { color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 5px; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.table-scroll { overflow: auto; max-height: calc(100vh - 285px); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
thead th { position: sticky; top: 0; z-index: 3; background: #fafbfc; height: 36px; color: #5a6170; text-align: left; font-weight: 700; padding: 0 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
th.money, td.money { text-align: right; font-variant-numeric: tabular-nums; }
.status-col { width: 185px; }
.action-col { width: 38px; }
tbody td { height: 39px; padding: 0 9px; border-bottom: 1px solid var(--line); vertical-align: middle; background: white; }
tbody tr.data-row:hover td { background: #fbfbfe; }
.group-row td { position: sticky; top: 36px; z-index: 2; height: 36px; background: #f1f3f7; border-bottom: 1px solid var(--line-strong); font-weight: 700; color: #343a46; }
.group-toggle { border: 0; background: transparent; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 0; color: inherit; font-weight: inherit; }
.group-stats { float: right; font-weight: 500; color: var(--muted); }
.task-name { font-weight: 650; max-width: 330px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-name { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #4e5563; }
.status-select { width: 165px; border: 0; border-radius: 999px; padding: 4px 24px 4px 9px; font-size: 11px; font-weight: 700; color: #343a46; background: var(--soft); outline: none; }
.status-select[data-tone="green"] { background: #e8f7ef; color: #137548; }
.status-select[data-tone="blue"] { background: #eaf1ff; color: #315fb6; }
.status-select[data-tone="amber"] { background: #fff4df; color: #996515; }
.status-select[data-tone="purple"] { background: #f0ecff; color: #6149b4; }
.status-select[data-tone="red"] { background: #fdecef; color: #a82d45; }
.date-cell { white-space: nowrap; color: #4f5663; }
.assignee { white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.integrity { color: var(--amber); font-weight: 800; margin-right: 4px; }
.open-row { border: 0; background: transparent; color: var(--accent); font-size: 18px; padding: 5px 8px; }
.empty { padding: 40px !important; text-align: center; color: var(--muted); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20,24,35,.18); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; width: min(500px, 44vw); height: 100vh; z-index: 30; background: white; box-shadow: -18px 0 40px rgba(25,30,45,.18); transform: translateX(105%); transition: transform .18s ease; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 20px 20px 16px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.icon-button { border: 1px solid var(--line); background: white; border-radius: 7px; width: 32px; height: 32px; font-size: 20px; }
.drawer-body { padding: 18px 20px; overflow: auto; flex: 1; }
.drawer-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.detail-section { margin-bottom: 22px; }
.detail-title { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 800; letter-spacing: .055em; margin-bottom: 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.field { border: 1px solid var(--line); border-radius: 8px; padding: 9px; min-height: 62px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-size: 10px; color: var(--muted); font-weight: 750; text-transform: uppercase; margin-bottom: 5px; }
.field input, .field select { width: 100%; height: 30px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 7px; background: white; }
.field input.money-input { text-align: right; font-variant-numeric: tabular-nums; }
.read-value { font-size: 13px; line-height: 1.4; }
.comment-box { padding: 10px 11px; border-left: 3px solid var(--line-strong); background: #fafbfc; color: #4f5663; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.warning-box { border: 1px solid #f1d69d; background: #fff8e9; color: #885e18; padding: 9px 10px; border-radius: 7px; font-size: 12px; margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #20242d; color: white; padding: 9px 13px; border-radius: 8px; box-shadow: var(--shadow); z-index: 50; opacity: 0; pointer-events: none; transition: .18s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8f2539; }
.skeleton { animation: pulse 1.2s infinite ease-in-out; background: #eef0f4; color: transparent; border-radius: 6px; }
@keyframes pulse { 50% { opacity: .55; } }
@media (max-width: 900px) { .app-shell { min-width: 1050px; } }
