:root {
  --brand: #c8651f; --brand-d: #7a3e1d; --brand-l: #fbeee3; --bg: #f7f4f1; --card: #fff; --line: #ebe4dd;
  --text: #2a2420; --muted: #7b716a; --ok: #1f8a4c; --ok-l: #e4f5eb; --bad: #c0392b; --bad-l: #fbe9e7; --warn: #b7791f; --warn-l: #fdf3e1;
  --info: #2b6cb0; --info-l: #e6f0fa; --radius: 10px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 2px 8px rgba(60,40,20,.05);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand-d); }
h1 { font-size: 20px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* Layout */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #2b1d14; color: #f4e9df; padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { font-weight: 800; font-size: 18px; padding: 4px 10px 16px; letter-spacing: .3px; }
.logo small { display: block; font-weight: 400; font-size: 11px; color: #c9b5a5; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; color: #e9dcd1; text-decoration: none; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.07); } .nav a.active { background: var(--brand); color: #fff; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; color: #a9937f; padding: 14px 10px 4px; letter-spacing: .6px; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.page { padding: 20px 24px 60px; max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.user-chip { display: flex; gap: 12px; align-items: center; }
.user-chip .role { font-size: 11px; color: var(--muted); }

/* Cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .l { font-size: 11.5px; color: var(--muted); } .kpi .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; } .muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .spread { justify-content: space-between; }
.chart-box { position: relative; height: 260px; }

/* Buttons & form */
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
button:hover, .btn:hover { border-color: #cdbfb3; } button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .primary:hover { background: #b45917; }
.danger { color: var(--bad); border-color: #efc7c2; } .ghost { background: transparent; border-color: transparent; } .sm { padding: 4px 8px; font-size: 12px; }
.ok-btn { background: var(--ok); border-color: var(--ok); color: #fff; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 7px 9px; border: 1px solid #ddd2c8; border-radius: 8px; background: #fff; color: var(--text); }
textarea { min-height: 70px; resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid #f1c9a6; border-color: var(--brand); }
.field { margin-bottom: 12px; } .field.err input, .field.err select, .field.err textarea { border-color: var(--bad); }
.field .msg { color: var(--bad); font-size: 11.5px; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; } .form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; background: var(--card); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.filters .f { min-width: 130px; } .filters label { margin-bottom: 2px; } .filters input, .filters select { padding: 6px 8px; }
.check { display: flex; gap: 8px; align-items: center; padding: 5px 0; color: var(--text); font-size: 13px; } .check input { width: auto; }

/* Table */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: #fbf8f5; position: sticky; top: 0; white-space: nowrap; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--brand-d); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fdf8f3; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eee; color: #555; }
.b-ok { background: var(--ok-l); color: var(--ok); } .b-bad { background: var(--bad-l); color: var(--bad); } .b-warn { background: var(--warn-l); color: var(--warn); } .b-info { background: var(--info-l); color: var(--info); } .b-brand { background: var(--brand-l); color: var(--brand-d); }
.st-draft { background: #eee; color: #555; } .st-briefing { background: #ede7f6; color: #5e35b1; } .st-design_production { background: #e3f2fd; color: #1565c0; }
.st-marketing_review { background: var(--warn-l); color: var(--warn); } .st-revision { background: var(--bad-l); color: var(--bad); } .st-approved { background: #e0f2f1; color: #00796b; }
.st-scheduled { background: var(--info-l); color: var(--info); } .st-published { background: var(--ok-l); color: var(--ok); } .st-performance_evaluation { background: #1f8a4c; color: #fff; }

/* Alerts & states */
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; } .alert.warn { background: var(--warn-l); color: #7a5112; } .alert.err { background: var(--bad-l); color: var(--bad); } .alert.info { background: var(--info-l); color: #1d4f85; }
.state { text-align: center; padding: 40px 16px; color: var(--muted); } .state .ico { font-size: 28px; margin-bottom: 6px; }
.spinner { width: 28px; height: 28px; border: 3px solid #eadfd5; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
.tabs button.on { color: var(--brand-d); border-bottom-color: var(--brand); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; } .seg button { border: none; border-radius: 0; border-right: 1px solid var(--line); } .seg button:last-child { border-right: none; } .seg button.on { background: var(--brand); color: #fff; }

/* Calendar */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px; font-size: 11.5px; text-transform: uppercase; color: var(--muted); background: #fbf8f5; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; position: relative; }
.cal-cell:nth-child(7n) { border-right: none; } .cal-cell.other { background: #fcfaf8; } .cal-cell.other .d { color: #c2b6ab; }
.cal-cell.today .d { background: var(--brand); color: #fff; border-radius: 50%; }
.cal-cell .d { font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; width: 22px; height: 22px; }
.cal-cell .add { position: absolute; right: 4px; top: 3px; opacity: 0; } .cal-cell:hover .add { opacity: 1; }
.cal-cell.drop, .day-slot.drop { background: #fff3e6; outline: 2px dashed var(--brand); outline-offset: -3px; }
.ev { font-size: 11.5px; padding: 3px 6px; border-radius: 6px; margin-top: 3px; cursor: grab; border-left: 3px solid; background: #f5f2ef; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .sd { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; border: 1px solid rgba(0,0,0,.15); }
.ev:active { cursor: grabbing; } .ev.locked { cursor: pointer; opacity: .9; } .ev .t { color: var(--muted); margin-right: 4px; }
.ev.cancelled { text-decoration: line-through; opacity: .5; }
.more { font-size: 11px; color: var(--brand-d); cursor: pointer; margin-top: 2px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); } .week-col { border-right: 1px solid var(--line); min-height: 420px; padding: 6px; } .week-col:last-child { border-right: none; }
.week-col h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); } .week-col.today h4 { color: var(--brand); }
.day-slot { display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid var(--line); min-height: 44px; } .day-slot .h { font-size: 11.5px; color: var(--muted); padding: 6px; border-right: 1px solid var(--line); } .day-slot .c { padding: 4px 6px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* Pipeline */
.pipe { display: flex; gap: 0; overflow-x: auto; margin: 10px 0 4px; }
.pipe span { flex: 1; min-width: 92px; text-align: center; font-size: 11px; padding: 7px 4px; background: #f1ece7; color: var(--muted); position: relative; }
.pipe span.done { background: #f7dcc4; color: var(--brand-d); } .pipe span.cur { background: var(--brand); color: #fff; font-weight: 700; }
.pipe span:first-child { border-radius: 8px 0 0 8px; } .pipe span:last-child { border-radius: 0 8px 8px 0; }

.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); position: relative; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline .when { font-size: 11px; color: var(--muted); }

/* Modal / drawer / toast */
.modal-bg { position: fixed; inset: 0; background: rgba(30,20,10,.38); display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { max-width: 1050px; } .modal.narrow { max-width: 460px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 16px 18px; } .modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fcfaf8; border-radius: 0 0 12px 12px; }
#toast-root { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: #2b1d14; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; animation: up .2s ease; } .toast.err { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.notif { position: relative; } .notif .dot { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 5px; }
.notif-panel { position: absolute; right: 0; top: 38px; width: 360px; max-height: 440px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 40; }
.notif-panel .it { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; cursor: pointer; } .notif-panel .it.unread { background: #fff7ef; } .notif-panel .it:hover { background: #fbf2ea; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #2b1d14, #7a3e1d 60%, #c8651f); }
.login .card { width: 360px; padding: 26px; } .login h1 { margin-bottom: 4px; } .login .demo { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.6; }

/* Evaluation */
.eval { border-left: 4px solid var(--brand); } .eval ul { margin: 6px 0; padding-left: 18px; } .eval li { margin: 3px 0; }
.eval .rule { font-size: 11px; color: var(--muted); }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
.bar { height: 8px; background: #f0e8e1; border-radius: 99px; overflow: hidden; min-width: 80px; } .bar > i { display: block; height: 100%; background: var(--brand); }
.bar.ok > i { background: var(--ok); } .bar.bad > i { background: var(--bad); }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.asset { border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 11.5px; } .asset img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; background: #f3eee9; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; } .side { position: static; height: auto; display: flex; flex-wrap: wrap; } .nav { display: flex; flex-wrap: wrap; } .nav .sec { display: none; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; } .cal-cell { min-height: 80px; }
}
@media print { .side, .topbar, .filters, .no-print { display: none !important; } .layout { display: block; } .page { padding: 0; } }
