/* ===========================================================================
   ProfeAcademī · Calendario de Pruebas — Design System
   Soft UI · glassmorphism light · indigo/violeta · Poppins
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand */
  --primary:        #4f46e5;
  --primary-600:    #4338ca;
  --primary-700:    #3730a3;
  --primary-weak:   #eef2ff;
  --primary-glow:   rgba(79, 70, 229, 0.18);

  /* Neutrals — light */
  --bg:             #f5f5fb;
  --bg-grad-1:      #eef0fb;
  --bg-grad-2:      #f7f5fc;
  --surface:        #ffffff;
  --surface-2:      #fafaff;
  --surface-glass:  rgba(255, 255, 255, 0.72);
  --surface-sunken: #f3f3fa;
  --text:           #211d36;
  --text-2:         #4a4663;
  --text-muted:     #8b88a3;
  --text-faint:     #b4b1c6;
  --border:         #e9e8f3;
  --border-strong:  #dcdaec;
  --hairline:       rgba(33, 29, 54, 0.06);

  /* Today / accents */
  --today-bg:       #eef0ff;
  --today-ring:     #4f46e5;

  /* Status tints */
  --holiday-bg:     #fdecec;
  --holiday-line:   #ef4444;
  --holiday-text:   #b42424;
  --plan-bg:        #fff6e6;
  --plan-line:      #f59e0b;
  --plan-text:      #9a6608;
  --ok-bg:          #e9f9f0;
  --ok-line:        #10b981;
  --ok-text:        #0a7a52;
  --warn-bg:        #fff1e8;
  --warn-line:      #f97316;
  --danger:         #ef4444;
  --danger-bg:      #fdeaea;

  /* Subject palette (5) — assigned by id % 5 */
  --subj-0:    #7c3aed;  --subj-0-bg: #f1ebfe;  --subj-0-soft: #ede5fd;  /* violeta */
  --subj-1:    #059669;  --subj-1-bg: #e6f6ef;  --subj-1-soft: #d8f1e6;  /* verde */
  --subj-2:    #d97706;  --subj-2-bg: #fdf2e0;  --subj-2-soft: #fbe9c9;  /* ámbar */
  --subj-3:    #e11d48;  --subj-3-bg: #fde9ee;  --subj-3-soft: #fbd9e1;  /* rojo */
  --subj-4:    #2563eb;  --subj-4-bg: #e7eefe;  --subj-4-soft: #d6e2fc;  /* azul */

  /* Elevation */
  --shadow-xs:  0 1px 2px rgba(33,29,54,0.05);
  --shadow-sm:  0 2px 8px rgba(33,29,54,0.06);
  --shadow-md:  0 8px 24px rgba(33,29,54,0.09);
  --shadow-lg:  0 18px 48px rgba(33,29,54,0.16);
  --shadow-glow:0 8px 28px var(--primary-glow);

  /* Radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Type */
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --primary:        #7c75f0;
  --primary-600:    #8b85f3;
  --primary-700:    #a29bf6;
  --primary-weak:   #2a2748;
  --primary-glow:   rgba(124, 117, 240, 0.28);

  --bg:             #14131f;
  --bg-grad-1:      #181626;
  --bg-grad-2:      #11101a;
  --surface:        #1d1b2b;
  --surface-2:      #232032;
  --surface-glass:  rgba(29, 27, 43, 0.72);
  --surface-sunken: #181626;
  --text:           #ece9f7;
  --text-2:         #b6b2cf;
  --text-muted:     #8682a3;
  --text-faint:     #5d5a78;
  --border:         #2c2940;
  --border-strong:  #383450;
  --hairline:       rgba(255, 255, 255, 0.06);

  --today-bg:       #272343;
  --today-ring:     #7c75f0;

  --holiday-bg:     #3a1f22;  --holiday-text: #f3a3a3;
  --plan-bg:        #3a3019;  --plan-text:    #f3d29a;
  --ok-bg:          #16352a;  --ok-text:      #7fe0b6;
  --warn-bg:        #3a2719;
  --danger-bg:      #3a1f22;

  --subj-0:    #a78bfa;  --subj-0-bg: #2b2547;  --subj-0-soft: #332a52;
  --subj-1:    #34d399;  --subj-1-bg: #163528;  --subj-1-soft: #1c4231;
  --subj-2:    #fbbf24;  --subj-2-bg: #382b15;  --subj-2-soft: #45351a;
  --subj-3:    #fb7185;  --subj-3-bg: #3a1d27;  --subj-3-soft: #482330;
  --subj-4:    #60a5fa;  --subj-4-bg: #182944;  --subj-4-soft: #1d3354;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg:  0 18px 48px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--bg-grad-2), transparent 55%),
    var(--bg);
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--primary-glow); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================ App shell ================================ */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-main {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 0;
}

.view-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 24px;
}

/* ============================ Header ================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 6px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--primary), #7c5cf0);
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { line-height: 1.15; }
.brand-text .t1 { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-text .t2 { font-weight: 500; font-size: 11.5px; color: var(--text-muted); }

.topbar-spacer { flex: 1; }

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.seg button svg { width: 15px; height: 15px; opacity: .8; }
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
[data-theme="dark"] .seg button.active { background: var(--primary-weak); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .16s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-sunken); box-shadow: none; }
.btn.primary {
  background: linear-gradient(150deg, var(--primary), #6a5cf0);
  color: #fff; border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); }
.btn.icon { padding: 9px; border-radius: 11px; }
.btn.sm { padding: 6px 11px; font-size: 12px; }

/* Dropdown filter */
.filter {
  position: relative;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .16s var(--ease);
}
.filter-btn:hover { border-color: var(--border-strong); }
.filter-btn .chev { width: 13px; height: 13px; opacity: .6; transition: transform .2s; }
.filter-btn.open .chev { transform: rotate(180deg); }
.filter-btn .dot { width: 8px; height: 8px; border-radius: 50%; }
.filter-menu {
  position: absolute; top: calc(100% + 7px); left: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  animation: pop .16s var(--ease-out);
}
.filter-menu .opt {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 13px; color: var(--text-2);
  cursor: pointer;
  transition: background .12s;
}
.filter-menu .opt:hover { background: var(--surface-sunken); }
.filter-menu .opt.sel { color: var(--primary); font-weight: 600; }
.filter-menu .opt .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.filter-menu .opt .check { margin-left: auto; opacity: 0; }
.filter-menu .opt.sel .check { opacity: 1; }

@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* Role chip */
.role-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 6px 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.role-chip:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.role-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff;
  background: linear-gradient(150deg, #f59e0b, #ef4444);
}
.role-chip .who { line-height: 1.2; text-align: left; }
.role-chip .who .n { font-size: 12.5px; font-weight: 600; }
.role-chip .who .r { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.role-chip .badge {
  font-size: 10px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--primary-weak); color: var(--primary);
}

/* ============================ Period banner ========================== */
.period-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  font-size: 13px; font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.period-banner.active { background: var(--ok-bg); color: var(--ok-text); }
.period-banner.urgent { background: var(--holiday-bg); color: var(--holiday-text); }
.period-banner.locked { background: var(--plan-bg); color: var(--plan-text); }
.period-banner .pb-icon { font-size: 15px; }
.period-banner .countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700; letter-spacing: 0.02em;
}
.period-banner .pb-sub { color: inherit; opacity: .8; font-weight: 400; }

/* ============================ Sidebar ================================ */
.sidebar {
  width: 304px;
  flex-shrink: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mini-cal { padding: 18px 18px 14px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mini-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.mini-title .yr { color: var(--text-muted); font-weight: 500; margin-left: 5px; }
.mini-nav { display: flex; gap: 2px; }
.mini-nav button { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--text-muted); transition: all .14s; }
.mini-nav button:hover { background: var(--surface-sunken); color: var(--text); }
.mini-nav svg { width: 14px; height: 14px; }

.mini-grid { display: grid; grid-template-columns: 22px repeat(7, 1fr); gap: 1px 0; }
.mini-grid .wd { font-size: 9.5px; font-weight: 600; color: var(--text-faint); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: 0.03em; }
.mini-grid .cw-label { font-size: 8.5px; }
.mini-grid .cw { font-size: 9.5px; color: var(--text-faint); text-align: center; align-self: center; }
.mini-day {
  position: relative;
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 500;
  color: var(--text-2);
  border-radius: 8px;
  cursor: pointer;
  transition: all .12s;
}
.mini-day:hover { background: var(--surface-sunken); }
.mini-day.out { color: var(--text-faint); }
.mini-day.today { background: var(--primary); color: #fff; font-weight: 600; box-shadow: var(--shadow-glow); }
.mini-day.sel { box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); font-weight: 600; }
.mini-day .pip { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); display: flex; gap: 1.5px; }
.mini-day .pip i { width: 3px; height: 3px; border-radius: 50%; background: var(--primary); }
.mini-day.today .pip i { background: #fff; }

.agenda-head {
  padding: 6px 18px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.agenda { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 12px 16px; }
.agenda-group { margin-bottom: 4px; }
.agenda-date {
  display: flex; align-items: baseline; gap: 8px;
  padding: 12px 6px 7px;
  position: sticky; top: 0;
  background: linear-gradient(var(--surface-glass) 70%, transparent);
  backdrop-filter: blur(4px);
  z-index: 2;
}
.agenda-date .d-strong { font-size: 12.5px; font-weight: 600; color: var(--text); text-transform: capitalize; }
.agenda-date .d-rel { font-size: 11px; color: var(--text-muted); }
.agenda-date.is-today .d-strong { color: var(--primary); }

.agenda-item {
  display: flex; gap: 11px;
  padding: 9px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .12s;
}
.agenda-item:hover { background: var(--surface-sunken); }
.agenda-item .bar { width: 4px; border-radius: 999px; flex-shrink: 0; }
.agenda-item .ai-body { min-width: 0; flex: 1; }
.agenda-item .ai-time { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.agenda-item .ai-title { font-size: 13px; font-weight: 500; color: var(--text); margin: 1px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-item .ai-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.agenda-item .ai-meta .sdot { width: 7px; height: 7px; border-radius: 50%; }

.agenda-empty { text-align: center; color: var(--text-muted); font-size: 12.5px; padding: 30px 16px; }

.sidebar-foot {
  padding: 11px 18px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
.sidebar-foot .sw { width: 18px; height: 18px; border-radius: 5px; background: var(--primary); display: grid; place-items: center; }
.sidebar-foot .sw svg { width: 11px; height: 11px; color: #fff; }

/* ============================ View toolbar =========================== */
.view-toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px 4px;
}
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav .arrow { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); transition: all .14s; }
.date-nav .arrow:hover { border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.date-nav .arrow svg { width: 16px; height: 16px; }
.view-period { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; text-transform: capitalize; min-width: 200px; }
.view-period .vp-year { color: var(--text-muted); font-weight: 500; }
.view-period .vp-count { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 10px; text-transform: none; }

/* ============================ Month view ============================= */
.month {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-height: 100%;
}
.month-wd {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.month-wd div {
  padding: 11px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
}
.month-wd div.we { color: var(--text-faint); }
.month-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
}
.mcell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 7px 8px 8px;
  min-height: 112px;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
  position: relative;
  transition: background .12s;
}
.mcell:nth-child(7n) { border-right: none; }
.mcell:hover { background: var(--surface-2); }
.mcell.out { background: var(--surface-sunken); }
.mcell.out:hover { background: var(--surface-sunken); }
.mcell.we { background: linear-gradient(var(--surface-2), var(--surface-2)); }
.mcell.holiday { background: var(--holiday-bg); }
.mcell.plan { background: var(--plan-bg); }
.mcell.today { background: var(--today-bg); box-shadow: inset 0 0 0 2px var(--today-ring); border-radius: 2px; z-index: 1; }

.mcell-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.mcell-num { font-size: 13px; font-weight: 600; color: var(--text-2); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; }
.mcell.out .mcell-num { color: var(--text-faint); font-weight: 500; }
.mcell.today .mcell-num { background: var(--primary); color: #fff; box-shadow: var(--shadow-glow); }
.mcell-badges { display: flex; gap: 4px; align-items: center; }
.cell-badge {
  font-size: 9.5px; font-weight: 600; padding: 2px 7px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 3px;
}
.cell-badge.holiday { background: var(--holiday-line); color: #fff; }
.cell-badge.plan { background: var(--plan-line); color: #fff; }
.cell-badge.full { background: var(--warn-line); color: #fff; }

.mcell-events { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.more-link { font-size: 11px; font-weight: 600; color: var(--primary); padding: 1px 4px; }

/* ============================ Chips ================================= */
/* Variant: bar (default) */
.chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; line-height: 1.3;
  border-radius: 7px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .1s, box-shadow .12s;
}
.chip:hover { transform: translateX(1px); }
.chip .c-time { font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.chip .c-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* bar */
.chip.v-bar { padding: 3px 7px 3px 5px; background: var(--cbg); border-left: 3px solid var(--cln); }
.chip.v-bar .c-time { color: var(--cln); }
.chip.v-bar .c-label { color: var(--text); }

/* pill */
.chip.v-pill { padding: 3px 9px; border-radius: var(--r-pill); background: var(--cbg); }
.chip.v-pill .c-time { color: var(--cln); }
.chip.v-pill .c-label { color: var(--ctx); }

/* dot */
.chip.v-dot { padding: 2px 4px; background: transparent; gap: 6px; }
.chip.v-dot .c-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cln); flex-shrink: 0; }
.chip.v-dot:hover { background: var(--surface-sunken); }
.chip.v-dot .c-time { color: var(--text-muted); }
.chip.v-dot .c-label { color: var(--text-2); }

/* ============================ Week view ============================== */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  min-height: 100%;
}
.wcol {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  min-height: 0;
}
.wcol.today { box-shadow: inset 0 0 0 2px var(--today-ring), var(--shadow-sm); }
.wcol.we { background: var(--surface-2); }
.wcol.we.dim { opacity: 0.62; }
.wcol-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  position: sticky; top: 0;
  background: var(--surface);
}
.wcol.we .wcol-head { background: var(--surface-2); }
.wcol.today .wcol-head { background: var(--today-bg); }
.wcol-head .wd { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.wcol-head .dn { font-size: 22px; font-weight: 600; margin-top: 2px; letter-spacing: -0.02em; }
.wcol.today .wcol-head .dn { color: var(--primary); }
.wcol-head .day-tag { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: var(--r-pill); margin-top: 4px; display: inline-block; }
.wcol-head .day-tag.holiday { background: var(--holiday-line); color: #fff; }
.wcol-head .day-tag.plan { background: var(--plan-line); color: #fff; }
.wcol-body { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.wcard {
  border-radius: var(--r-md);
  background: var(--cbg);
  border-left: 4px solid var(--cln);
  padding: 9px 11px;
  cursor: pointer;
  transition: transform .12s, box-shadow .14s;
}
.wcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.wcard .wc-time { font-size: 11px; font-weight: 700; color: var(--cln); font-variant-numeric: tabular-nums; }
.wcard .wc-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 2px 0 5px; line-height: 1.25; }
.wcard .wc-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-tag { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: var(--r-pill); background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.wcol-empty { flex: 1; display: grid; place-items: center; color: var(--text-faint); font-size: 12px; text-align: center; padding: 20px 8px; }

/* ============================ Day view ============================== */
.day-view { max-width: 760px; margin: 0 auto; width: 100%; padding-bottom: 60px; }
.day-hero {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.day-hero .dh-eyebrow { font-size: 13px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; }
.day-hero .dh-title { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; text-transform: capitalize; line-height: 1.05; margin: 4px 0 6px; }
.day-hero .dh-sub { font-size: 15px; color: var(--text-muted); font-weight: 500; }
.day-daynav { display: flex; gap: 8px; }

.day-banner {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 18px;
  border-radius: var(--r-lg);
  margin-bottom: 18px;
  font-weight: 500;
}
.day-banner.holiday { background: var(--holiday-bg); color: var(--holiday-text); border: 1px solid var(--holiday-line); }
.day-banner.plan { background: var(--plan-bg); color: var(--plan-text); border: 1px solid var(--plan-line); }
.day-banner .db-icon { font-size: 24px; }
.day-banner .db-title { font-size: 15px; font-weight: 700; }
.day-banner .db-sub { font-size: 13px; opacity: .85; }

.day-cards { display: flex; flex-direction: column; gap: 14px; }
.dcard {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .14s, box-shadow .16s;
}
.dcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dcard .dc-bar { width: 8px; background: var(--cln); flex-shrink: 0; }
.dcard .dc-main { flex: 1; padding: 18px 20px; min-width: 0; }
.dcard .dc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dcard .dc-time { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--cln); background: var(--cbg); padding: 4px 11px; border-radius: var(--r-pill); }
.dcard .dc-time svg { width: 13px; height: 13px; }
.dcard .dc-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 12px; line-height: 1.2; }
.dcard .dc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dc-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface-sunken); color: var(--text-2); }
.dc-chip .sdot { width: 9px; height: 9px; border-radius: 50%; }
.dc-chip svg { width: 14px; height: 14px; opacity: .7; }
.dcard .dc-desc { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.dcard .dc-actions { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.day-actions-row { display: flex; gap: 8px; align-items: center; }

/* Floating action button */
.fab {
  position: absolute; bottom: 26px; right: 26px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 20px;
  border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--primary), #6a5cf0);
  color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transition: transform .16s var(--ease-out), filter .16s;
  z-index: 30;
}
.fab:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.05); }
.fab svg { width: 19px; height: 19px; }

/* ============================ Empty / states ======================== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 60px 24px; color: var(--text-muted);
  min-height: 340px;
}
.empty-state .es-icon {
  width: 84px; height: 84px; border-radius: 24px;
  background: var(--primary-weak); color: var(--primary);
  display: grid; place-items: center; margin-bottom: 20px;
}
.empty-state .es-icon svg { width: 40px; height: 40px; }
.empty-state .es-title { font-size: 19px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state .es-sub { font-size: 14px; max-width: 320px; line-height: 1.55; margin-bottom: 20px; }

/* ============================ Modal ================================= */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(20, 18, 35, 0.42);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn .24s var(--ease-out);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.modal-head .mh-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.modal-head .mh-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.modal-close { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--text-muted); transition: all .14s; }
.modal-close:hover { background: var(--surface-sunken); color: var(--text); }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* Form */
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field label .opt-tag { color: var(--text-faint); font-weight: 400; margin-left: 5px; }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: all .15s var(--ease);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: var(--surface); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b88a3' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.limit-meter {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  margin-bottom: 4px;
}
.limit-meter.ok { background: var(--ok-bg); color: var(--ok-text); }
.limit-meter.warn { background: var(--plan-bg); color: var(--plan-text); }
.limit-meter.full { background: var(--holiday-bg); color: var(--holiday-text); }
.limit-meter .lm-bar { flex: 1; height: 7px; border-radius: 999px; background: rgba(0,0,0,0.08); overflow: hidden; }
.limit-meter .lm-fill { height: 100%; border-radius: 999px; transition: width .3s var(--ease); }
.limit-meter.ok .lm-fill { background: var(--ok-line); }
.limit-meter.warn .lm-fill { background: var(--plan-line); }
.limit-meter.full .lm-fill { background: var(--holiday-line); }

/* table for admin modals */
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.dtable td { padding: 11px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.dtable tr:last-child td { border-bottom: none; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); }
.tag.holiday { background: var(--holiday-bg); color: var(--holiday-text); }
.tag.plan { background: var(--plan-bg); color: var(--plan-text); }

/* Multi-select bottom bar */
.multibar {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--text); color: var(--surface);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  z-index: 35;
  animation: pop .2s var(--ease-out);
}
[data-theme="dark"] .multibar { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.multibar .mb-count { font-size: 13px; font-weight: 600; padding: 0 8px; }
.multibar button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 500;
  color: inherit; opacity: .92;
  transition: background .14s;
}
.multibar button:hover { background: rgba(255,255,255,0.14); }
[data-theme="dark"] .multibar button:hover { background: var(--surface-sunken); }
.multibar .div { width: 1px; height: 22px; background: rgba(255,255,255,0.18); }
[data-theme="dark"] .multibar .div { background: var(--border); }

.mcell .cell-check {
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center;
  transition: all .14s;
}
.mcell .cell-check svg { width: 13px; height: 13px; opacity: 0; color: #fff; }
.mcell.selected .cell-check { background: var(--primary); border-color: var(--primary); }
.mcell.selected .cell-check svg { opacity: 1; }
.mcell.selectable:hover { background: var(--primary-weak); }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--text); color: var(--surface);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .26s var(--ease-out);
}
[data-theme="dark"] .toast { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* responsive */
@media (max-width: 1080px) {
  .sidebar { width: 256px; }
}
@media (max-width: 880px) {
  .sidebar { display: none; }
}

/* skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--surface-2) 50%, var(--surface-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* utility */
.hide { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
