:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #172033;
  --muted: #6b768a;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #eff6ff;
  --success: #16815d;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --danger: #c0392b;
  --danger-soft: #fef2f2;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --sidebar: #121a2b;
  --sidebar-muted: #9eabc0;
  --shadow: 0 12px 30px rgba(25, 36, 58, .08);
  --radius: 14px;
}

* { 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; color: var(--text); background: var(--bg); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: white; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #5b8cff, #2563eb); font-weight: 800; }
.brand-name { font-weight: 800; letter-spacing: -.02em; }
.brand-sub { color: var(--sidebar-muted); font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav-secondary { margin-top: auto; }
.nav-item { border: 0; background: transparent; color: var(--sidebar-muted); text-align: left; padding: 10px 11px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-weight: 650; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: rgba(91,140,255,.17); color: white; }
.nav-item > span:first-child { width: 18px; text-align: center; }
.count-pill { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 11px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 16px 8px 0; color: var(--sidebar-muted); }
.storage-row { display: flex; gap: 8px; align-items: center; font-size: 12px; margin: 6px 0 4px; }
.status-dot { width: 7px; height: 7px; background: #34d399; border-radius: 50%; box-shadow: 0 0 0 3px rgba(52,211,153,.12); }
.micro-label { font-size: 10px; letter-spacing: .12em; font-weight: 800; color: #6f7d94; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 82px; background: rgba(244,247,251,.93); backdrop-filter: blur(10px); display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 28px; border-bottom: 1px solid var(--border); }
h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.top-actions { display: flex; gap: 9px; }
.content { padding: 24px 28px 44px; max-width: 1480px; margin: 0 auto; }

.btn { border: 1px solid var(--border); background: white; color: var(--text); border-radius: 9px; padding: 9px 13px; font-weight: 700; box-shadow: 0 1px 1px rgba(0,0,0,.02); }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-2); text-decoration: none; }
.btn-ghost { background: rgba(255,255,255,.72); }
.btn-small { padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-link { border: 0; background: transparent; padding: 0; color: var(--accent); font-weight: 700; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 750; }
.nowrap { white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 22px; }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 16px 17px; box-shadow: 0 3px 10px rgba(25,36,58,.03); }
.kpi-value { font-size: 27px; font-weight: 820; letter-spacing: -.04em; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 650; margin-top: 4px; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 8px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stack { display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-pad { padding: 18px; }
.panel-head { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.panel-title { font-weight: 800; letter-spacing: -.015em; }
.panel-subtitle { color: var(--muted); font-size: 12px; margin-top: 3px; }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: #4b586d; margin: 0 0 10px; }

.focus-list { padding: 6px 0; }
.focus-item { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid #eef2f7; }
.focus-item:last-child { border-bottom: 0; }
.rank { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; font-size: 12px; font-weight: 850; background: var(--accent-soft); color: var(--accent); }
.focus-title { font-weight: 760; }
.focus-meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.focus-actions { display: flex; gap: 7px; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 760; background: #f1f5f9; color: #526074; white-space: nowrap; }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-orange { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }

.quick-list { display: grid; }
.quick-item { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid #eef2f7; }
.quick-item:last-child { border-bottom: 0; }
.checkbox-btn { width: 18px; height: 18px; border: 1.5px solid #cbd5e1; background: white; border-radius: 5px; padding: 0; }
.checkbox-btn:hover { border-color: var(--accent); }

.deadline-row { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef2f7; }
.deadline-row:last-child { border-bottom: 0; }
.date-chip { background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; text-align: center; overflow: hidden; }
.date-chip .mon { font-size: 9px; text-transform: uppercase; padding: 3px; color: var(--muted); }
.date-chip .day { font-size: 17px; font-weight: 820; padding: 0 0 4px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { min-width: 260px; flex: 1; }
.input, .select, .textarea { width: 100%; border: 1px solid #d7dee8; border-radius: 9px; padding: 9px 10px; color: var(--text); background: white; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: #8fb1ff; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.select { width: auto; min-width: 130px; }
.textarea { min-height: 90px; resize: vertical; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: white; }
.segmented button { border: 0; border-right: 1px solid var(--border); background: white; padding: 8px 10px; color: var(--muted); font-size: 12px; font-weight: 750; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--accent-soft); color: var(--accent); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #738096; padding: 10px 12px; background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #edf1f6; vertical-align: middle; font-size: 13px; }
tr.clickable:hover td { background: #fbfdff; }
tr.clickable { cursor: pointer; }

.progress { height: 7px; background: #eaf0f7; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4f7ef7, #2563eb); }
.progress-label { display: grid; grid-template-columns: minmax(80px,1fr) 38px; align-items: center; gap: 8px; }

.kanban { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #eef2f7; border-radius: 13px; min-height: 360px; padding: 10px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; color: #526074; padding: 2px 2px 10px; }
.kanban-card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 11px; margin-bottom: 8px; box-shadow: 0 3px 8px rgba(25,36,58,.04); cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card .uni { font-size: 11px; color: var(--muted); }
.kanban-card .program { font-size: 12px; font-weight: 780; margin: 3px 0 8px; }
.kanban-col.drag-over { outline: 2px dashed #8fb1ff; outline-offset: -4px; }

.program-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.program-card { background: white; border: 1px solid var(--border); border-radius: 13px; padding: 15px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 5px 15px rgba(25,36,58,.035); }
.program-card:hover { border-color: #c7d5eb; box-shadow: 0 8px 24px rgba(25,36,58,.07); }
.program-card h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.program-uni { font-size: 12px; color: var(--muted); }
.program-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.program-desc { font-size: 12px; color: #556277; line-height: 1.48; }
.card-actions { margin-top: auto; display: flex; align-items: center; gap: 8px; justify-content: space-between; }

.doc-group { margin-bottom: 16px; }
.doc-group-head { font-size: 11px; font-weight: 800; color: #647086; text-transform: uppercase; letter-spacing: .06em; padding: 8px 12px; background: #f8fafc; }
.doc-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) 150px 130px minmax(220px, 1fr); gap: 12px; align-items: center; padding: 11px 12px; border-bottom: 1px solid #edf1f6; }
.doc-row:last-child { border-bottom: 0; }
.inline-select { border: 1px solid var(--border); background: white; border-radius: 7px; padding: 5px 7px; font-size: 12px; }

.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calendar-title { font-size: 18px; font-weight: 820; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); background: white; }
.calendar-dow { padding: 8px; font-size: 10px; font-weight: 800; text-transform: uppercase; color: #748196; text-align: center; background: #f8fafc; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar-day { min-height: 118px; padding: 7px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: white; }
.calendar-day.outside { background: #fbfcfe; color: #a3adbb; }
.calendar-day.today { box-shadow: inset 0 0 0 2px #8fb1ff; }
.day-num { font-size: 11px; font-weight: 800; margin-bottom: 5px; }
.cal-event { font-size: 10px; padding: 4px 5px; border-radius: 5px; margin: 3px 0; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.cal-task { background: var(--accent-soft); color: var(--accent); }
.cal-official { background: var(--danger-soft); color: var(--danger); }
.cal-internal { background: var(--warning-soft); color: var(--warning); }
.cal-action { background: var(--purple-soft); color: var(--purple); }

.review-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; min-height: 120px; padding: 16px 4px 4px; }
.review-bar-wrap { display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; text-align: center; color: var(--muted); font-size: 10px; }
.review-bar-zone { display: flex; align-items: end; justify-content: center; height: 90px; }
.review-bar { width: min(30px, 70%); min-height: 4px; background: linear-gradient(180deg, #6d98ff, #2563eb); border-radius: 6px 6px 2px 2px; }

.inbox-compose { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.inbox-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf1f6; }
.inbox-actions { display: flex; gap: 6px; align-items: center; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
label { font-size: 11px; font-weight: 800; color: #5d697d; }
.help { font-size: 11px; color: var(--muted); }

.backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.34); z-index: 90; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(560px, 94vw); background: white; z-index: 100; box-shadow: -12px 0 40px rgba(15,23,42,.18); overflow-y: auto; }
.drawer-head { position: sticky; top: 0; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 18px 20px; display: flex; align-items: start; justify-content: space-between; z-index: 2; }
.drawer-body { padding: 18px 20px 30px; display: grid; gap: 18px; }
.drawer-section { border-top: 1px solid var(--border); padding-top: 16px; }
.drawer-section:first-child { border-top: 0; padding-top: 0; }
.icon-btn { border: 1px solid var(--border); background: white; width: 32px; height: 32px; border-radius: 9px; font-size: 17px; }

.checklist { display: grid; gap: 7px; }
.check-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 9px; align-items: center; padding: 8px 9px; border: 1px solid var(--border); border-radius: 9px; }
.check-row.done { background: #fbfefc; }
.check-row.done .check-name { color: #728071; text-decoration: line-through; }
.check-indicator { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; border: 1.5px solid #cbd5e1; background: white; font-size: 11px; }
.check-row.done .check-indicator { background: var(--success); border-color: var(--success); color: white; }

.modal { position: fixed; z-index: 110; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(620px, 92vw); max-height: 88vh; overflow: auto; background: white; border-radius: 15px; box-shadow: 0 24px 70px rgba(15,23,42,.25); }
.modal-head { padding: 17px 19px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 19px; }
.modal-foot { padding: 14px 19px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.hidden { display: none !important; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 200; background: #172033; color: white; padding: 10px 13px; border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty strong { color: var(--text); }
.rule { height: 1px; background: var(--border); margin: 14px 0; }
.callout { border: 1px solid #cfe0ff; background: #f7faff; border-radius: 11px; padding: 13px; color: #344b70; font-size: 12px; line-height: 1.5; }
.warning-callout { border-color: #fed7aa; background: #fffaf3; color: #8b4a13; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 200px minmax(0,1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .kpi-grid, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .grid-even { grid-template-columns: 1fr; }
  .doc-row { grid-template-columns: 1fr 120px; }
  .doc-notes, .doc-date { display: none; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center; padding: 10px; }
  .brand, .sidebar-foot, .nav-secondary { display: none; }
  .nav { display: flex; gap: 5px; }
  .nav-item { white-space: nowrap; }
  .topbar { padding: 14px 16px; }
  .content { padding: 16px; }
  .top-actions .btn-ghost { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .calendar-day { min-height: 80px; }
  .cal-event { font-size: 0; height: 7px; padding: 0; }
}
