:root {
  --primary: #10b981; --primary-dark: #059669; --primary-glow: rgba(16, 185, 129, 0.4); --primary-dim: rgba(16, 185, 129, 0.12);
  --secondary: #3b82f6; --deadline: #f59e0b; --danger: #ef4444;
  --bg-anim: linear-gradient(-45deg, #0f172a, #1e1b4b, #064e3b, #020617);
  --side-w: 240px; --side-collapsed: 75px; --font-main: 13px; --ring-circumference: 276.46;
}
html { transition: background 0.6s ease, color 0.6s ease; }
body, .card, .dash-card, .set-section, .widget, .cal-event-item, .dl-item, .bug-item,
.avg-tile, .dash-task-item, .btn, .btn-sec, .btn-danger, .dl-add-btn, .ev-add-btn,
.cal-nav-btn, .pdf-btn, .action-btn, .btn-side, .auth-box, .toast, #alert-box, #sidebar, #main,
.nav-item, .mob-nav-item, .set-input, .dl-input, .dl-search, .dl-date, .dl-subj-select,
.dl-sort, .ev-input, .score-input, input, select, textarea, button {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}
body { transition: background 0.6s ease, color 0.6s ease; }
[data-theme="dark"] { --side-bg: rgba(30, 41, 59, .7); --card-bg: rgba(30, 41, 59, .6); --text: #f8fafc; --sub: #94a3b8; --border: rgba(255, 255, 255, .1); --input-bg: rgba(15, 23, 42, .6); }
[data-theme="light"] { --bg-anim: linear-gradient(-45deg, #f1f5f9, #e2e8f0, #dcfce7, #f1f5f9); --side-bg: rgba(255, 255, 255, .85); --card-bg: rgba(255, 255, 255, .95); --text: #0f172a; --sub: #475569; --border: rgba(0, 0, 0, .1); --input-bg: #fff; }
* { box-sizing: border-box; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
body { margin: 0; padding: 0; color: var(--text); display: flex; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg-anim); background-size: 400% 400%; animation: gradientBG 15s ease infinite; font-size: var(--font-main); }
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
body[data-logged-in="true"] #auth { display: none !important; }
body:not([data-logged-in="true"]) #sidebar, body:not([data-logged-in="true"]) #main, body:not([data-logged-in="true"]) #mobile-nav { display: none !important; }
.view { display: none; }
.view.active { display: flex; flex-direction: column; flex: 1; min-height: 0; animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#portal { position: fixed; inset: 0; background: rgba(2, 6, 23, .85); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(8px); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--primary); border-top: 3px solid transparent; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
#auth { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { width: 100%; max-width: 340px; padding: 30px; border-radius: 24px; border: 1px solid var(--border); text-align: center; backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
[data-theme="dark"] .auth-box { background: rgba(15, 23, 42, 0.75); }
[data-theme="light"] .auth-box { background: rgba(255, 255, 255, 0.75); }
.auth-tabs { display: flex; background: var(--input-bg); border-radius: 12px; padding: 4px; margin-bottom: 22px; border: 1px solid var(--border); }
.auth-tab { flex: 1; padding: 9px; border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; border: none; background: none; color: var(--sub); transition: .2s; }
.auth-tab.active { background: var(--primary); color: #fff; }
#auth-saved { display: none; margin-bottom: 18px; padding: 14px 16px; background: var(--primary-dim); border-radius: 14px; border: 1px solid var(--primary-glow); }
#auth-saved p { margin: 0 0 10px; font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: .5px; }
.switch-user-link { display: inline-block; margin-top: 8px; font-size: 10px; color: var(--sub); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; background: none; border: none; transition: color .2s ease; }
#sidebar { width: var(--side-w); background: var(--side-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 12px; backdrop-filter: blur(10px); transition: width .3s cubic-bezier(.4, 0, .2, 1); position: relative; z-index: 100; }
#sidebar.collapsed { width: var(--side-collapsed); }
#sidebar.collapsed h1 { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
#sidebar.collapsed .nav-item span, #sidebar.collapsed .btn-side span { opacity: 0; max-width: 0; pointer-events: none; }
#sidebar.collapsed .collapse-btn { transform: rotate(180deg); }
#sidebar.collapsed .nav-item, #sidebar.collapsed .btn-side { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
#sidebar h1 { color: var(--primary); font-size: 16px; margin: 0 0 30px 10px; font-weight: 800; white-space: nowrap; transition: opacity .2s; }
.nav-item { padding: 12px 15px; margin-bottom: 8px; border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--sub); transition: .2s; display: flex; align-items: center; gap: 15px; white-space: nowrap; overflow: hidden; }
.nav-item span { transition: opacity .2s, max-width .2s; max-width: 200px; overflow: hidden; display: inline-block; }
.nav-item.active { background: var(--primary); color: white; }
.nav-item:hover:not(.active) { background: var(--border); }
.collapse-btn { position: absolute; top: 18px; right: -11px; width: 22px; height: 22px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid var(--side-bg); font-size: 9px; z-index: 5; transition: all .3s cubic-bezier(.4, 0, .2, 1); }
#mobile-nav { display: none; }
#main { flex: 1; padding: 30px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden; }
#view-container { flex: 1 0 auto; display: flex; flex-direction: column; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-shrink: 0; }
body:not([data-view="home"]) .dash-header { display: none !important; }
#top-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; margin-bottom: 30px; flex-shrink: 0; }
.widget { background: var(--card-bg); border: 1px solid var(--border); padding: 15px; border-radius: 18px; backdrop-filter: blur(10px); }
.widget-label { font-size: 10px; font-weight: 800; color: var(--sub); text-transform: uppercase; margin-bottom: 4px; }
.widget-value { font-size: 18px; font-weight: 800; }
.widget-sub { font-size: 11px; font-weight: 700; color: var(--sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#offline-banner { display: none; position: fixed; top: 0; left: 0; right: 0; background: var(--deadline); color: #000; font-weight: 800; font-size: 12px; text-align: center; padding: 6px; z-index: 99998; letter-spacing: .5px; }
body.offline #offline-banner { display: block; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 25px; }
.dash-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; padding: 20px; }
.dash-card h3 { margin: 0 0 15px 0; font-size: 16px; color: var(--text); }
.dash-task-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--input-bg); border-radius: 10px; margin-bottom: 8px; font-size: 12px; }
.dash-task-item.empty { color: var(--sub); text-align: center; display: block; padding: 20px; }
.focus-stat-big { font-size: 32px; font-weight: 900; color: var(--secondary); text-align: center; margin: 10px 0 5px; }
.focus-stat-sub { font-size: 11px; color: var(--sub); text-align: center; text-transform: uppercase; font-weight: 700; }
.focus-chart { display: flex; align-items: flex-end; gap: 4px; height: 60px; margin: 15px 0 5px; }
.focus-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.focus-bar { width: 100%; background: linear-gradient(180deg, var(--secondary), rgba(59,130,246,.3)); border-radius: 4px; min-height: 3px; transition: height .4s ease; margin-top: auto; }
.focus-bar-lbl { font-size: 8px; font-weight: 800; color: var(--sub); text-transform: uppercase; }
.focus-history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.focus-history-grid h4 { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--sub); margin: 0 0 10px; }
.fh-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--input-bg); margin-bottom: 6px; font-size: 12px; }
.fh-row .k { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-row .v { font-weight: 800; color: var(--secondary); font-family: ui-monospace, monospace; }
.avg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; }
.avg-tile { background: var(--card-bg); border: 1px solid var(--border); padding: 25px 15px; border-radius: 20px; text-align: center; border-bottom: 4px solid var(--primary); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.avg-tile:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, .15); }
.avg-tile h2 { margin: 0; font-size: 32px; font-weight: 900; color: var(--primary); }
.avg-tile p { margin: 6px 0 0; font-weight: 700; color: var(--sub); font-size: 10px; text-transform: uppercase; }
.focus-container { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 20px; }
.timer-ring { width: 280px; height: 280px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 30px; transition: filter .3s ease; }
.timer-ring.active { filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.5)); }
.timer-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fill { fill: none; stroke: var(--secondary); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 276.46; stroke-dashoffset: 276.46; transition: stroke-dashoffset .35s linear, stroke .3s ease; }
.timer-display { font-size: 64px; font-weight: 900; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.focus-controls { display: flex; gap: 15px; width: 100%; max-width: 300px; margin-bottom: 30px; }
.focus-controls-row { display: flex; gap: 15px; margin-bottom: 25px; align-items: center; flex-wrap: wrap; justify-content: center; }
.focus-subj-select {
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.focus-time-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}
.focus-time-input {
  width: 56px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.focus-time-input::-webkit-outer-spin-button,
.focus-time-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.focus-time-label {
  font-weight: 700;
  color: var(--sub);
  font-size: 11px;
  letter-spacing: .5px;
}
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; align-items: start; }
.quick-access-mobile { display: none; }
.set-section { background: var(--card-bg); padding: 20px; border-radius: 20px; border: 1px solid var(--border); }
.set-section h3 { margin: 0 0 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; font-size: 16px; }
.set-section.danger-zone { border-color: rgba(239, 68, 68, .3); }
.set-section.danger-zone h3 { color: var(--danger); border-bottom-color: rgba(239, 68, 68, .2); }
.danger-warning { font-size: 11px; color: var(--sub); margin-top: 0; margin-bottom: 15px; line-height: 1.5; }
.set-input-group { margin-bottom: 15px; }
.set-input-group label { display: block; font-size: 11px; font-weight: 700; color: var(--sub); margin-bottom: 5px; text-transform: uppercase; }
.set-input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); outline: none; }
.set-input:focus { border-color: var(--primary); }
.pw-strength { margin-top: 6px; font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; min-height: 12px; }
.pw-strength.weak { color: var(--danger); } .pw-strength.fair { color: var(--deadline); } .pw-strength.good { color: var(--secondary); } .pw-strength.strong { color: var(--primary); }
.goal-item { display: flex; justify-content: space-between; padding: 10px; background: var(--input-bg); border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.friend-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); }
.friend-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; overflow: hidden; }
.tt-container { background: var(--card-bg); border: 1px solid var(--border); border-radius: 24px; flex: 1 0 600px; display: flex; flex-direction: column; overflow: hidden; }
.pdf-header { padding: 8px 16px; background: var(--card-bg); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 10px; flex-wrap: wrap; }
.pdf-ctrl-group { display: flex; align-items: center; gap: 6px; }
.pdf-page-info { font-size: 11px; font-weight: 700; color: var(--sub); min-width: 70px; text-align: center; }
.pdf-zoom-info { font-size: 11px; font-weight: 700; color: var(--primary); min-width: 44px; text-align: center; }
#pdf-scroll { flex: 1; overflow-y: auto; overflow-x: auto; display: flex; flex-direction: column; align-items: flex-start; padding: 16px 0; gap: 12px; background: #525659; border-radius: 0 0 22px 22px; }
#pdf-scroll canvas { display: block; box-shadow: 0 2px 12px rgba(0, 0, 0, .5); margin: 0 auto; max-width: none; }
#grade-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; }
.subject-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.subj-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.grade-badge { padding: 3px 8px; border-radius: 6px; font-weight: 800; font-size: 11px; min-width: 60px; text-align: center; }
.g-a { background: #d1fae5; color: #065f46; } .g-b { background: #dbeafe; color: #1e40af; } .g-c { background: #fef9c3; color: #854d0e; } .g-fail { background: #fee2e2; color: #991b1b; }
.score-input { background: var(--input-bg); border: 1px solid var(--border); color: var(--primary); font-weight: 800; font-size: 16px; width: 85px; padding: 6px; border-radius: 10px; text-align: center; outline: none; }
.grade-meter-wrap { margin-top: 10px; background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.grade-meter-bar { height: 100%; border-radius: 99px; transition: width .35s ease, background .35s ease; width: 0%; }
.grade-meter-label { margin-top: 5px; font-size: 10px; font-weight: 700; color: var(--sub); text-align: right; }
.save-indicator { font-size: 11px; font-weight: 700; color: var(--sub); margin-right: 12px; opacity: 0; transition: opacity .3s ease; }
.save-indicator.show { opacity: 1; }
.save-indicator.saved { color: var(--primary); }
.calendar-view-layout { display: grid; grid-template-columns: 1fr 400px; gap: 25px; flex-shrink: 0; margin-bottom: 30px; }
.calendar-main, .calendar-sidebar { display: flex; flex-direction: column; flex-shrink: 0; }
.calendar-main { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.cal-header h3 { margin: 0; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
#cal-grid { flex: 1; grid-auto-rows: minmax(70px, 1fr); }
.cal-day-head { text-align: center; font-size: 10px; font-weight: 800; color: var(--sub); padding-bottom: 8px; }
.cal-day { border-radius: 10px; padding: 8px; font-weight: 700; font-size: 12px; cursor: pointer; border: 1px solid transparent; transition: border .2s; position: relative; }
.cal-day.other-month { opacity: .3; }
.cal-day:not(.other-month):hover { border-color: var(--primary); }
.cal-day.selected { border-color: var(--primary); background: var(--primary-dim); }
.cal-day.today .day-number { background: var(--primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.cal-dots { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 4px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.school { background: var(--primary); } .cal-dot.personal { background: var(--secondary); } .cal-dot.deadline { background: var(--deadline); }
.calendar-sidebar h3 { margin: 0 0 15px; font-size: 18px; flex-shrink: 0; }
#cal-event-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 5px; min-height: 150px; }
.cal-event-item { padding: 10px 12px; border-radius: 8px; background: var(--card-bg); border: 1px solid var(--border); border-left: 3px solid transparent; position: relative; flex-shrink: 0; }
.cal-event-item.school { border-left-color: var(--primary); } .cal-event-item.personal { border-left-color: var(--secondary); } .cal-event-item.deadline { border-left-color: var(--deadline); }
.ev-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin-top: 15px; flex-shrink: 0; }
.ev-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ev-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 12px; outline: none; }
.ev-input.full-width { grid-column: 1 / -1; }
input[type="date"], input[type="time"] { min-height: 40px; -webkit-appearance: none; appearance: none; font-family: 'Inter', sans-serif; }
[data-theme="dark"] { color-scheme: dark; } [data-theme="light"] { color-scheme: light; }
.ev-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; word-break: break-word; }
.ev-time { font-size: 11px; font-weight: 600; color: var(--sub); margin-bottom: 6px; }
.ev-desc { font-size: 12px; color: var(--sub); white-space: pre-wrap; word-break: break-word; }
.ev-del { position: absolute; top: 6px; right: 6px; background: none; border: none; color: var(--sub); cursor: pointer; font-size: 14px; opacity: .4; transition: opacity .15s; }
.ev-del:hover { opacity: 1; color: #ef4444; }
.ev-dup { position: absolute; top: 6px; right: 28px; background: none; border: none; color: var(--sub); cursor: pointer; font-size: 12px; opacity: .4; transition: opacity .15s; }
.ev-dup:hover { opacity: 1; color: var(--primary); }
.dl-toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.dl-input { flex: 1; min-width: 160px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 13px; outline: none; }
.dl-input:focus { border-color: var(--primary); }
.dl-search { flex: 1; min-width: 160px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 13px; outline: none; }
.dl-search:focus { border-color: var(--primary); }
.dl-date, .dl-subj-select { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 13px; outline: none; }
.dl-date { width: 150px; }
.dl-subj-select { width: 130px; }
.dl-sort { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 12px; outline: none; cursor: pointer; font-weight: 700; }
.dl-filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; flex-shrink: 0; align-items: center; }
.dl-filter-btn { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--border); background: none; color: var(--sub); font-size: 11px; font-weight: 700; cursor: pointer; transition: .15s; }
.dl-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dl-count { font-size: 11px; color: var(--sub); font-weight: 700; margin-left: auto; }
#dl-list { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.dl-item { background: var(--card-bg); border: 1px solid var(--border); border-left: 3px solid transparent; border-radius: 16px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; transition: opacity .2s; }
.dl-item.done .dl-title { text-decoration: line-through; color: var(--sub); }
.dl-item.done { opacity: .45; }
.dl-item.overdue { border-left-color: #ef4444; } .dl-item.due-soon { border-left-color: var(--deadline); } .dl-item.due-ok { border-left-color: #10b981; }
.dl-cb { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--sub); appearance: none; -webkit-appearance: none; cursor: pointer; flex-shrink: 0; transition: .15s; position: relative; }
.dl-cb:checked { background: var(--primary); border-color: var(--primary); }
.dl-cb:checked::after { content: ''; position: absolute; left: 5px; top: 2px; width: 6px; height: 10px; border: 2px solid #fff; border-top: none; border-left: none; transform: rotate(45deg); }
.dl-info { flex: 1; min-width: 0; }
.dl-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-meta { margin-top: 3px; font-size: 11px; color: var(--sub); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dl-subj-tag { padding: 2px 8px; border-radius: 6px; background: var(--primary-dim); color: var(--primary); font-weight: 700; font-size: 10px; }
.dl-days-badge { font-weight: 700; font-size: 11px; }
.dl-days-badge.overdue { color: #ef4444; } .dl-days-badge.today { color: var(--deadline); } .dl-days-badge.soon { color: var(--deadline); } .dl-days-badge.ok { color: #10b981; } .dl-days-badge.done-lbl { color: var(--sub); }
.dl-del { background: none; border: none; color: var(--sub); cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1; flex-shrink: 0; opacity: .4; transition: opacity .15s; }
.dl-del:hover { opacity: 1; color: #ef4444; }
.dl-empty { text-align: center; padding: 50px 20px; color: var(--sub); font-size: 13px; font-weight: 600; }
.dl-empty-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: .5; }
.btn { background: var(--primary); color: white; border: none; padding: 12px; border-radius: 12px; width: 100%; font-weight: 700; cursor: pointer; font-size: 13px; transition: all 0.2s ease; }
.btn-sec { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); padding: 12px; border-radius: 12px; width: 100%; font-weight: 700; cursor: pointer; font-size: 13px; transition: all 0.2s ease; }
.btn-danger { background: rgba(239, 68, 68, .1); color: var(--danger); border: 1px solid rgba(239, 68, 68, .3); padding: 12px; border-radius: 12px; width: 100%; font-weight: 700; cursor: pointer; font-size: 13px; transition: all 0.2s ease; }
.dl-add-btn { padding: 11px 20px; border-radius: 12px; background: var(--primary); color: #fff; border: none; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; transition: all 0.2s ease; }
.ev-add-btn { grid-column: 1 / -1; padding: 10px; border-radius: 10px; background: var(--secondary); color: #fff; border: none; font-weight: 700; font-size: 13px; cursor: pointer; transition: all 0.2s ease; }
.btn:hover, .dl-add-btn:hover { background: var(--primary-dark); box-shadow: 0 4px 12px var(--primary-glow); transform: translateY(-2px); }
.btn-sec:hover { background: var(--border); }
.btn-danger:hover { background: var(--danger); color: white; }
.ev-add-btn:hover { background: #2563eb; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); transform: translateY(-2px); }
.cal-nav-btn, .pdf-btn { background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; line-height: 1; transition: all 0.2s ease; }
.cal-nav-btn:hover, .pdf-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-side { margin-top: 8px; font-size: 11px; padding: 10px; background: var(--border); color: var(--text); border: 1px solid var(--border); border-radius: 10px; width: 100%; cursor: pointer; display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; transition: all 0.2s ease; }
.btn-side:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.2); }
.btn-side.danger { color: var(--danger); border-color: rgba(239, 68, 68, .3); background: rgba(239, 68, 68, .1); }
.btn-side.danger:hover { background: rgba(239, 68, 68, .2); border-color: rgba(239, 68, 68, .4); }
.btn-side span { transition: opacity .2s, max-width .2s; max-width: 200px; overflow: hidden; display: inline-block; }
.action-btn { display: none; }
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(30, 41, 59, .97); color: #f8fafc; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 13px; font-weight: 600; min-width: 220px; max-width: 340px; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(12px); pointer-events: auto; animation: toastIn .3s cubic-bezier(.4,0,.2,1); }
[data-theme="light"] .toast { background: rgba(255,255,255,.97); color: #0f172a; border-color: rgba(0,0,0,.1); }
.toast.leaving { animation: toastOut .3s ease forwards; }
.toast.success { border-left: 4px solid var(--primary); } .toast.error { border-left: 4px solid var(--danger); } .toast.info { border-left: 4px solid var(--secondary); } .toast.warning { border-left: 4px solid var(--deadline); }
.toast-icon { font-size: 16px; flex-shrink: 0; } .toast-msg { flex: 1; }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }
#alert-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); z-index: 9999; display: flex; justify-content: center; align-items: center; padding: 15px; }
#alert-box { background-color: var(--card-bg); color: var(--text); padding: 25px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); max-width: 400px; width: 100%; text-align: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; animation: fadeIn 0.3s ease-out; border: 1px solid var(--border); backdrop-filter: blur(12px); }
#alert-message { font-size: 16px; margin: 0 0 20px 0; line-height: 1.5; white-space: pre-wrap; color: var(--text); }
#alert-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 14px; outline: none; margin-bottom: 15px; font-family: inherit; }
#alert-input:focus { border-color: var(--primary); }
#alert-buttons { display: flex; justify-content: center; gap: 8px; }
#alert-cancel-btn { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 10px 24px; border-radius: 5px; cursor: pointer; font-size: 16px; font-weight: 600; transition: background-color 0.2s; }
#alert-cancel-btn:hover { background: rgba(128,128,128,.15); }
#alert-close-btn { background-color: var(--primary); color: white; border: none; padding: 10px 24px; border-radius: 5px; cursor: pointer; font-size: 16px; font-weight: 600; transition: background-color 0.2s; }
#alert-close-btn:hover { background-color: var(--primary-dark); }
.hidden { display: none !important; }
@media (max-width: 768px) {
  #sidebar { display: none !important; }
  #main { padding: 15px 15px 100px 15px !important; overflow-y: auto !important; }
  #view-container, .view.active { display: flex !important; flex-direction: column !important; height: auto !important; min-height: 0 !important; }
  body:not([data-view="home"]) #top-widgets, body:not([data-view="home"]) .dash-header { display: none !important; }
  .action-btn { display: flex !important; background: rgba(239, 68, 68, .1); color: #ef4444; border: 1px solid rgba(239, 68, 68, .2); border-radius: 12px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; align-items: center; justify-content: center; transition: all 0.2s ease; }
  .action-btn:hover { background: rgba(239, 68, 68, .2); transform: translateY(-2px); }
  .action-btn.theme-btn { color: var(--text); border-color: var(--border); background: var(--input-bg); }
  .action-btn.theme-btn:hover { background: var(--border); }
  #mobile-nav { display: none !important; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: calc(100% - 24px); max-width: 400px; background: rgba(30, 41, 59, 0.95); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 35px; z-index: 9000; padding: 6px 10px; justify-content: space-between; align-items: center; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
  body[data-logged-in="true"] #mobile-nav { display: flex !important; }
  [data-theme="light"] body[data-logged-in="true"] #mobile-nav { background: rgba(255, 255, 255, 0.95); border: 1px solid rgba(0, 0, 0, 0.1); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); }
  .mob-nav-item { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: var(--sub); cursor: pointer; transition: all 0.3s ease; flex-shrink: 0; }
  .mob-nav-item b { font-size: 19px; margin: 0; line-height: 1; font-weight: normal; }
  .mob-nav-item.active { color: var(--primary); background: var(--primary-dim); }
  .mob-nav-item span { display: none; }
  #top-widgets { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 10px; margin-bottom: 20px; }
  .dash-grid { grid-template-columns: 1fr !important; }
  .settings-grid { grid-template-columns: 1fr !important; }
  .quick-access-mobile { display: block; }
  .focus-history-grid { grid-template-columns: 1fr !important; }
  .avg-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .widget { padding: 12px; } .widget-value { font-size: 16px; }
  .avg-tile { padding: 15px 10px; } .avg-tile h2 { font-size: 24px; } .avg-tile p { font-size: 9px; }
  .calendar-view-layout { display: flex !important; flex-direction: column !important; height: auto !important; min-height: 0 !important; gap: 15px; }
  .calendar-main, .calendar-sidebar { display: block !important; height: auto !important; min-height: 0 !important; }
  #cal-event-list { min-height: 150px; max-height: 300px; margin-bottom: 15px; }
  .cal-day { aspect-ratio: 1 / 1; padding: 4px; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
  .cal-day .day-number { margin-top: 2px; }
  .cal-day.today .day-number { width: 22px; height: 22px; }
  .cal-dots { position: relative; bottom: auto; left: auto; transform: none; margin-top: auto; margin-bottom: 4px; justify-content: center; }
  #cal-grid { display: grid !important; grid-auto-rows: auto !important; }
  .ev-form-grid { grid-template-columns: 1fr; gap: 8px; }
  .dl-toolbar { flex-direction: column; align-items: stretch; }
  .dl-toolbar input, .dl-toolbar select, .dl-toolbar button { width: 100% !important; margin-bottom: 5px; }
  .desktop-only { display: none !important; }
  .pdf-header { flex-direction: row !important; justify-content: space-between !important; padding: 12px !important; flex-wrap: nowrap !important; }
  .pdf-ctrl-group { justify-content: center; flex-wrap: nowrap; }
  .pdf-btn { padding: 8px 12px; font-size: 14px; }
  .tt-container { display: flex !important; flex-direction: column !important; height: calc(100vh - 140px) !important; border-radius: 16px; flex: none !important; }
  .auth-box { width: 90%; padding: 20px; }
  .timer-ring { width: 220px; height: 220px; }
  .timer-display { font-size: 48px; }
  #toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { max-width: none; }
  .focus-time-inputs { padding: 6px 14px; gap: 8px; }
  .focus-time-input { width: 44px; font-size: 16px; }
}
.bug-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 25px; align-items: start; }
.bug-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bug-tip { font-size: 12px; color: var(--sub); line-height: 1.6; margin: 0 0 14px; }
textarea.set-input { resize: vertical; line-height: 1.55; font-size: 13px; font-family: inherit; }
.bug-count { font-size: 10px; font-weight: 700; color: var(--sub); text-align: right; margin-top: 4px; }
.bug-count.near { color: var(--deadline); }
.bug-item { border: 1px solid var(--border); border-left: 3px solid var(--sub); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--input-bg); }
.bug-item.st-open { border-left-color: var(--deadline); } .bug-item.st-in-progress { border-left-color: var(--secondary); } .bug-item.st-resolved { border-left-color: var(--primary); } .bug-item.st-wont-fix { border-left-color: var(--sub); opacity: .65; }
.bug-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bug-id { font-size: 10px; font-weight: 800; letter-spacing: .5px; color: var(--sub); }
.bug-status { margin-left: auto; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.bug-item-title { font-weight: 700; font-size: 13px; word-break: break-word; }
.bug-item-meta { font-size: 11px; color: var(--sub); margin-top: 4px; }
.bug-item-note { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--sub); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 900px) { .bug-grid { grid-template-columns: 1fr; gap: 15px; } }
@media (max-width: 768px) { .bug-row { grid-template-columns: 1fr; } }

/* ============================================================
   ACCENT COLOUR PICKER — 44px swatches
   ============================================================ */
.accent-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.accent-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .15s, border-color .2s, box-shadow .2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  position: relative;
}
.accent-swatch:hover { transform: scale(1.08); }
.accent-swatch:active { transform: scale(0.96); }
.accent-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--text), 0 2px 8px rgba(0, 0, 0, .3);
}
.accent-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
@media (max-width: 768px) {
  .accent-picker { gap: 10px; }
  .accent-swatch { width: 44px; height: 44px; }
  .accent-swatch.active::after { font-size: 18px; }
}

/* ============================================================
   LEGAL — floating pill button + Privacy / Terms modal
   ============================================================ */
.legal-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  height: 38px;
  padding: 0 16px 0 8px;
  border-radius: 19px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .2px;
  z-index: 10001;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  transition: background-color .2s, color .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.legal-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}
.legal-btn-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 1px;
}
.legal-btn-text { white-space: nowrap; font-size: 12px; }
@media (max-width: 768px) {
  .legal-btn {
    bottom: 18px;
    right: 14px;
    height: 34px;
    padding: 0 14px 0 7px;
    gap: 7px;
    font-size: 11px;
  }
  .legal-btn-icon { width: 20px; height: 20px; font-size: 11px; }
  .legal-btn-text { font-size: 11px; }
  body[data-logged-in="true"] .legal-btn { bottom: 84px; }
}

.legal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}
.legal-overlay.hidden { display: none !important; }

.legal-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.legal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background-color .2s, color .2s;
}
.legal-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.legal-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.legal-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: background-color .2s, color .2s;
  position: relative;
  bottom: -1px;
}
.legal-tab.active {
  background: var(--input-bg);
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}
.legal-body {
  overflow-y: auto;
  padding: 20px 24px 28px;
  flex: 1;
  min-height: 0;
}
.legal-pane { display: none; }
.legal-pane.active { display: block; }
.legal-pane h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; color: var(--text); }
.legal-updated { font-size: 11px; color: var(--sub); margin: 0 0 18px; font-weight: 600; }
.legal-pane h4 { font-size: 13px; font-weight: 800; color: var(--primary); margin: 20px 0 6px; letter-spacing: .2px; }
.legal-pane p { font-size: 13px; line-height: 1.65; color: var(--text); margin: 0 0 10px; }
.legal-pane ul { margin: 0 0 12px; padding-left: 22px; }
.legal-pane li { font-size: 13px; line-height: 1.65; color: var(--text); margin-bottom: 5px; }
.legal-pane b { font-weight: 800; }
@media (max-width: 600px) {
  .legal-modal { max-height: 90vh; border-radius: 16px; }
  .legal-body { padding: 16px 18px 22px; }
  .legal-tab { font-size: 12px; padding: 9px 8px; }
}
