/* ============================================================
   Studia — academic study-group theme
   ============================================================ */
:root {
  --paper: #f4f1ea;
  --paper-2: #ede9df;
  --card: #fffdf8;
  --ink: #252219;
  --ink-soft: #4b463a;
  --muted: #837c6d;
  --line: #e2dccf;
  --line-strong: #d4ccbc;
  --brand: #1e4d3b;
  --brand-2: #285f4b;
  --brand-deep: #152f24;
  --gold: #d9a441;
  --gold-soft: #f5e6c4;
  --danger: #b3402e;
  --danger-soft: #f6dcd3;
  --todo: #8a8577;
  --inprog: #c96a12;
  --done: #1c7a43;
  --shadow-sm: 0 1px 2px rgba(43, 36, 20, .05), 0 2px 8px rgba(43, 36, 20, .06);
  --shadow-md: 0 6px 16px rgba(43, 36, 20, .10), 0 2px 6px rgba(43, 36, 20, .07);
  --shadow-lg: 0 24px 48px rgba(34, 28, 16, .22), 0 4px 12px rgba(34, 28, 16, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
  --topbar-h: 68px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold-soft); color: var(--ink); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c8c0ae transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #c8c0ae; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  background: linear-gradient(180deg, #1d2a24 0%, #17231e 100%);
  color: #e9e3d4;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 14px 16px;
  border-right: 1px solid #0f1a15;
}
.brand {
  display: flex; gap: 12px; align-items: center;
  padding: 4px 10px 22px;
  border-bottom: 1px solid rgba(233, 227, 212, .12);
  margin-bottom: 16px;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, #2c6a50, #1e4d3b);
  border: 1px solid rgba(217, 164, 65, .45);
  display: grid; place-items: center;
  color: #f2d9a0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 4px 10px rgba(0,0,0,.35);
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 21px; font-weight: 700; letter-spacing: .2px;
  color: #faf5e8; line-height: 1.15;
}
.brand-sub {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.6px;
  color: #a7a08c; margin-top: 3px;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #d8d2bf;
  text-decoration: none;
  font-size: 14px; font-weight: 550;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(233, 227, 212, .08); color: #fdfaf0; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(217, 164, 65, .18), rgba(217, 164, 65, .06));
  border-color: rgba(217, 164, 65, .4);
  color: #fbe9bd;
}
.nav-item.active svg { opacity: 1; color: var(--gold); }

.sidebar-subjects { margin-top: 20px; padding: 0 4px; }
.sidebar-label {
  font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase;
  color: #a79f8a; padding: 0 10px 8px;
}
#sidebarSubjectList { display: flex; flex-direction: column; gap: 2px; }
.subject-quick {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 9px; font-size: 13px;
  color: #c9c2ac; background: transparent; border: none; cursor: pointer;
  font-family: inherit; text-align: left; width: 100%;
  transition: background .15s, color .15s;
}
.subject-quick:hover { background: rgba(233, 227, 212, .08); color: #fdfaf0; }
.subject-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,.25);
}
.subject-quick .scount { margin-left: auto; font-size: 11px; color: #8f8976; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(233, 227, 212, .1);
}
.member-chip-side {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  background: rgba(233, 227, 212, .06);
  border: 1px solid rgba(233, 227, 212, .09);
  cursor: pointer; transition: background .15s;
}
.member-chip-side:hover { background: rgba(233, 227, 212, .12); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff; letter-spacing: .3px;
  flex-shrink: 0; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.member-chip-side .mc-name { font-size: 13px; font-weight: 600; color: #efe9d8; line-height: 1.3; }
.member-chip-side .mc-role { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: #a39c87; }

/* ---------------- Main / topbar ---------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 22px;
  background: rgba(244, 241, 234, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.page-title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: .2px; }
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.search-wrap { position: relative; width: 320px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-wrap input {
  width: 100%; padding: 9px 12px 9px 34px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); font-size: 13px; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30, 77, 59, .12); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 200;
  display: none; max-height: 380px; overflow-y: auto;
}
.search-results.open { display: block; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; transition: background .12s; }
.search-item:hover { background: #f2eee3; }
.search-item .si-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; background: var(--gold-soft); color: var(--ink-soft); flex-shrink: 0; }
.search-item .si-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.search-item .si-meta { font-size: 11px; color: var(--muted); }

.member-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line-strong);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.member-chip:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.member-chip .mc-name { font-size: 13px; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-chip .mc-role { font-size: 10px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); }

.content { flex: 1; overflow-y: auto; padding: 26px 26px 60px; }

/* ---------------- Generic components ---------------- */
.view { animation: viewIn .3s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }

.section-title {
  font-family: var(--font-serif); font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--ink);
}
.section-title .count {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--paper-2); border-radius: 999px; padding: 2px 9px;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 9px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); color: #f7f1de; box-shadow: 0 4px 14px rgba(30, 77, 59, .3); }
.btn-primary:hover { background: var(--brand-2); box-shadow: 0 6px 20px rgba(30, 77, 59, .4); }
.btn-secondary { background: var(--card); color: var(--ink-soft); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn-gold { background: var(--gold); color: #3d2c08; box-shadow: 0 4px 14px rgba(217, 164, 65, .35); }
.btn-gold:hover { background: #e3b45a; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(179, 64, 46, .3); }
.btn-danger:hover { background: #a13626; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 7px; gap: 5px; }
.btn:disabled, .btn.loading { opacity: .6; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--paper-2); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 4px 11px; cursor: pointer;
  transition: all .14s; user-select: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); color: #f7f1de; border-color: var(--brand); }
.chip .chip-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent;
}
.badge-todo { background: #efecdf; color: var(--todo); border-color: #ddd6c2; }
.badge-in_progress { background: #fcead2; color: var(--inprog); border-color: #eed7b4; }
.badge-done { background: #dcf2e2; color: var(--done); border-color: #bfe5cc; }
.badge-low { background: #e6eef9; color: #31597e; border-color: #cfdcec; }
.badge-medium { background: #fdf0d7; color: #8a5a13; border-color: #eed8ae; }
.badge-high { background: #f9e0d8; color: var(--danger); border-color: #efc7ba; }

.muted { color: var(--muted); }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { font-size: 38px; opacity: .55; margin-bottom: 10px; }
.empty .empty-title { font-family: var(--font-serif); font-size: 17px; color: var(--ink-soft); font-weight: 700; margin-bottom: 4px; }
.empty .empty-sub { font-size: 13px; max-width: 340px; margin: 0 auto 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group[hidden] { display: none; }
.form-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .3px; }
.form-input, .form-select, .form-textarea {
  font-family: var(--font-sans); font-size: 13.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30, 77, 59, .13); }
.form-textarea { min-height: 76px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.avatar-xs { width: 20px; height: 20px; font-size: 9px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }

.tag-subject { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; }
.tag-subject .chip-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------------- Dashboard ---------------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.dash-grid.three-col { grid-template-columns: repeat(3, 1fr); }
.stat-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; position: relative; overflow: hidden; }
.stat-card .stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); }
.stat-card .stat-value { font-family: var(--font-serif); font-size: 34px; font-weight: 700; line-height: 1; color: var(--ink); }
.stat-card .stat-foot { font-size: 11.5px; color: var(--muted); }
.stat-card .stat-icon {
  position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 19px;
  background: var(--paper-2); color: var(--brand); opacity: .9;
}
.stat-accent-gold .stat-icon { background: var(--gold-soft); color: #7c5312; }
.stat-accent-green .stat-icon { background: #ddf0e3; color: var(--done); }
.stat-accent-blue .stat-icon { background: #e2e9f4; color: #31597e; }
.stat-accent-rose .stat-icon { background: #fadfd8; color: var(--danger); }

.agenda-list { display: flex; flex-direction: column; }
.agenda-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.agenda-item:last-child { border-bottom: none; }
.agenda-item .agenda-main { flex: 1; min-width: 0; }
.agenda-item .agenda-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-item .agenda-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.task-check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-strong);
  background: #fff; cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.task-check:hover { border-color: var(--brand); }
.task-check.checked { background: var(--done); border-color: var(--done); color: #fff; }
.task-check.inprog { border-color: var(--inprog); background: #fdf3e0; }
.task-check svg { width: 13px; height: 13px; }

.subject-bar-row { padding: 10px 4px; }
.subject-bar-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.subject-bar-head .sb-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.progress-track { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .5s ease; }

/* ---------------- Calendar ---------------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.cal-head-title { font-family: var(--font-serif); font-size: 21px; font-weight: 700; }
.cal-head-controls { display: flex; align-items: center; gap: 8px; }
.cal-nav-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; display: grid; place-items: center; transition: all .15s; color: var(--ink-soft); }
.cal-nav-btn:hover { border-color: var(--brand); color: var(--brand); }
.cal-nav-btn svg { width: 16px; height: 16px; }

.cal-grid { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); background: #faf7ef; }
.cal-weekday { padding: 10px 6px; text-align: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); }
.cal-weeks { display: grid; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal-week:last-child { border-bottom: none; }
.cal-day {
  min-height: 92px; padding: 8px 7px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 5px; cursor: pointer;
  transition: background .12s; position: relative; background: var(--card);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: #f7f3e8; }
.cal-day.outside { background: #f1eee5; }
.cal-day.outside .cal-day-num { color: #b3ab97; }
.cal-day.today .cal-day-num { background: var(--brand); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; font-weight: 700; }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day-num { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.cal-day-chip {
  display: block; font-size: 10.5px; font-weight: 600; line-height: 1.35;
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: #2b2517;
  border: 1px solid rgba(0,0,0,.08);
}
.cal-more { font-size: 10px; font-weight: 700; color: var(--muted); padding: 1px 7px; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; }

.day-panel { position: sticky; top: 14px; }
.day-panel-card { padding: 16px; }
.day-panel .day-picker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.day-panel h3 { font-family: var(--font-serif); font-size: 16px; font-weight: 700; }
.day-panel .day-sub { font-size: 11px; color: var(--muted); }

/* ---------------- Tasks ---------------- */
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-sep { width: 1px; height: 24px; background: var(--line-strong); margin: 0 4px; }
.select-compact { padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--card); font-size: 12.5px; color: var(--ink-soft); outline: none; cursor: pointer; }

.task-group { margin-bottom: 14px; }
.task-group-head { display: flex; align-items: center; gap: 10px; padding: 10px 4px; cursor: pointer; }
.task-group-head .tg-name { font-family: var(--font-serif); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.task-group-head .tg-count { font-size: 11px; color: var(--muted); font-weight: 600; }
.task-group-head .tg-progress { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.task-list { display: flex; flex-direction: column; gap: 7px; }
.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.task-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.task-row.done { opacity: .62; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-row .task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.task-sub .task-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.task-actions { display: flex; align-items: center; gap: 6px; }
.due-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-soft); background: var(--paper-2); white-space: nowrap; }
.due-badge.overdue { background: var(--danger-soft); color: var(--danger); border-color: #ecc3b7; }
.due-badge.today { background: #fcead2; color: #8a5a13; border-color: #eed7b4; }
.due-badge.soon { background: #ddf0e3; color: var(--done); border-color: #bfe5cc; }

/* ---------------- Files ---------------- */
.upload-zone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  background: linear-gradient(180deg, #fdfbf5, #f6f2e8);
  padding: 26px 18px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; margin-bottom: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--brand); background: #f6f1e2; }
.upload-zone .uz-icon { font-size: 26px; }
.upload-zone .uz-title { font-family: var(--font-serif); font-weight: 700; font-size: 16px; color: var(--ink); }
.upload-zone .uz-sub { font-size: 11.5px; color: var(--muted); }

.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.file-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; position: relative; transition: transform .15s, box-shadow .15s; }
.file-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.file-card .fc-head { display: flex; gap: 11px; align-items: flex-start; }
.file-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0; background: var(--paper-2); border: 1px solid var(--line);
}
.fc-name { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.fc-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.fc-foot { display: flex; gap: 7px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------------- Documents / Office ---------------- */
.doc-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: relative; transition: transform .15s, box-shadow .15s; }
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-card .dc-top { display: flex; align-items: flex-start; gap: 11px; }
.doc-ext {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 800; font-size: 12px; letter-spacing: .5px; flex-shrink: 0; color: #fff;
}
.doc-ext.docx { background: linear-gradient(145deg, #2b6fae, #1f4e7c); }
.doc-ext.xlsx { background: linear-gradient(145deg, #24963e, #16682c); }
.doc-ext.pptx { background: linear-gradient(145deg, #d4581c, #9c3410); }
.dc-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(100% - 60px); }
.dc-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.dc-actions { display: flex; gap: 7px; border-top: 1px solid var(--line); padding-top: 11px; flex-wrap: wrap; }
.office-banner {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, #fdf3d7, #f8ecd2);
  border: 1px solid #e9d6a4; border-radius: 12px; padding: 12px 14px;
  font-size: 12.5px; color: #6b5114; margin-bottom: 16px;
}
.office-banner svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------------- Members / Subjects ---------------- */
.members-grid, .subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.member-card, .subject-card { padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px; position: relative; transition: transform .15s, box-shadow .15s; }
.member-card:hover, .subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.member-card .mc-name { font-size: 15px; font-weight: 700; }
.subject-card .sc-icon { font-size: 26px; }
.subject-card .sc-name { font-size: 15px; font-weight: 700; }
.subject-card .sc-desc { font-size: 11px; color: var(--muted); min-height: 30px; }
.card-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 5px; opacity: 0; transition: opacity .15s; }
.member-card:hover .card-actions, .subject-card:hover .card-actions { opacity: 1; }

/* ---------------- Settings ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.settings-note { font-size: 12px; background: #f2eee3; border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; color: var(--ink-soft); margin-top: 6px; }

/* ---------------- Modals ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(28, 24, 16, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .18s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  animation: modalIn .25s cubic-bezier(.2,.9,.3,1.2);
  border: 1px solid var(--line);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 620px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 0; gap: 12px; }
.modal-title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; line-height: 1.2; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.modal-close { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink-soft); flex-shrink: 0; }
.modal-close:hover { border-color: var(--brand); color: var(--brand); }
.modal-body { padding: 18px 22px 6px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }

.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-option { border: 1.5px solid var(--line-strong); background: #fff; border-radius: 12px; padding: 14px 8px; text-align: center; cursor: pointer; transition: all .15s; }
.type-option:hover { border-color: var(--brand); }
.type-option.active { border-color: var(--brand); background: #eef4ee; box-shadow: 0 0 0 3px rgba(30,77,59,.12); }
.type-option .to-ext { width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; }
.type-option .to-name { font-size: 12px; font-weight: 700; }
.type-option .to-sub { font-size: 10.5px; color: var(--muted); }

/* color picker */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .12s, border-color .12s; }
.color-swatch.active { border-color: var(--ink); transform: scale(1.15); }

/* icon picker */
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-swatch { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; display: grid; place-items: center; font-size: 17px; cursor: pointer; transition: all .12s; }
.icon-swatch.active { border-color: var(--brand); background: #eef4ee; box-shadow: 0 0 0 3px rgba(30,77,59,.12); }

/* ---------------- Toast ---------------- */
.toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 900; display: flex; flex-direction: column; gap: 10px; max-width: 400px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: #23271f; color: #f5efdd; border-radius: 12px;
  padding: 12px 15px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 550;
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.15); border: 1px solid #3a4032;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast.success { border-left: 4px solid var(--done); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--gold); }
.toast .toast-icon { font-size: 17px; line-height: 1.2; }

/* ---------------- Office editor overlay ---------------- */
.office-overlay {
  position: fixed; inset: 0; z-index: 600; background: #111;
  display: flex; flex-direction: column; animation: fadeIn .2s ease;
}
.office-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--brand-deep); color: #f5efdd;
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,.1); flex-shrink: 0;
}
.office-bar .ob-title { font-family: var(--font-serif); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.office-bar .ob-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-bar .ob-ext { font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.14); }
.office-bar .spacer { flex: 1; }
.office-body { flex: 1; position: relative; background: #0e0d0b; }
.office-body #editorPlaceholder { width: 100%; height: 100%; }
.office-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #cfc9b6; text-align: center; padding: 30px; background: #151a16;
}
.office-fallback.hidden { display: none; }
.office-spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(217, 164, 65, .25); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.office-fallback .fb-title { font-family: var(--font-serif); font-size: 18px; color: #f5efdd; }
.office-fallback .fb-sub { font-size: 13px; color: #a49d88; max-width: 460px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .dash-grid, .dash-grid.three-col { grid-template-columns: 1fr; }
  .search-wrap { width: 200px; }
  .topbar { padding: 0 14px; }
  .members-grid, .subjects-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .content { padding: 16px 14px 60px; }
}

/* misc */
.kbd { font-size: 10.5px; background: var(--paper-2); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-family: inherit; }
.spin { animation: spin 1s linear infinite; }

/* ---- language toggle ---- */
.lang-toggle { display: flex; gap: 8px; }
.lang-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line, #d8cfc0);
  background: var(--paper, #fffdf7);
  color: var(--ink-soft, #4b4636);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.lang-btn:hover { border-color: var(--brand-soft, #c8b9a2); }
.lang-btn.active {
  background: var(--brand-deep, #7a2f1d);
  border-color: var(--brand-deep, #7a2f1d);
  color: #fff;
}
