:root {
  color-scheme: dark;
  --bg: #0a0f1d;
  --bg-elevated: rgba(15, 20, 36, 0.82);
  --panel: rgba(17, 23, 41, 0.84);
  --panel-2: rgba(20, 27, 48, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #98a2bc;
  --good: #6fe3b5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top left, rgba(91,120,255,0.22), transparent 30%), radial-gradient(circle at top right, rgba(47,196,155,0.18), transparent 26%), linear-gradient(135deg, #0a0f1d 0%, #14182a 55%, #101528 100%); color: var(--text); font-family: Inter, system-ui, sans-serif; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color-scheme: dark; }
select option { background: #131929; color: #f4f7fb; }
body { padding: 24px; }
.app-shell { max-width: 1560px; margin: 0 auto; display: grid; grid-template-columns: 300px minmax(0, 1.45fr) 340px; gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.sidebar { padding: 24px 20px; position: sticky; top: 24px; }
.center-stage { min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark { width: 30px; height: 30px; border-radius: 12px; background: linear-gradient(135deg, #76f2bc, #5a7dff); display: grid; place-items: center; color: #07111f; font-weight: 800; }
.brand-title { font-size: 1.75rem; font-weight: 700; }
.brand-sub { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.login-card, .menu-card, .team-card, .stats-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 20px; padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 8px; }
.card-subtitle { color: var(--muted); font-size: 0.92rem; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display:block; color: #c3cbe0; font-size: 0.82rem; margin-bottom: 8px; }
.field input, .field textarea, .field select { width:100%; border-radius: 14px; border: 1px solid rgba(255,255,255,0.09); background: #0e1425; color: var(--text); padding: 12px 14px; outline: none; color-scheme: dark; }
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(111,227,181,0.65); box-shadow: 0 0 0 4px rgba(111,227,181,0.12); }
.row { display:flex; gap:12px; }
.row > * { flex:1; }
.btn { border: 0; border-radius: 14px; padding: 12px 16px; cursor:pointer; transition: .2s ease; color: var(--text); background: rgba(255,255,255,0.06); }
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.1); }
.btn-primary { background: linear-gradient(135deg, #2cc58f, #4a72ff); }
.btn-secondary { background: rgba(255,255,255,0.08); }
.btn-danger { background: linear-gradient(135deg, #f97373, #db2777); }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.08); }
.btn-full { width:100%; }
.header-panel { padding: 24px; }
.topbar { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom: 18px; }
.title-wrap h1 { margin: 0; font-size: 2.3rem; }
.title-wrap p { margin: 8px 0 0; color: var(--muted); }
.action-bar { display:flex; gap:10px; flex-wrap:wrap; }
.pill { padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); color: #d8deee; }
.pill.active { background: rgba(111,227,181,0.14); border-color: rgba(111,227,181,0.42); color: #c8ffea; }
.user-chip { display:flex; align-items:center; gap:10px; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #ffd36d, #ff8b8b); display:grid; place-items:center; color:#101528; font-weight: 700; }
.dashboard-grid { display:grid; gap: 18px; }
.summary-strip { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.summary-card { border-radius: 18px; background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.07); padding: 16px 18px; }
.summary-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em; }
.summary-value { font-size: 1.15rem; font-weight: 700; }
.compact-guest { margin-top: 6px; }
.board-shell { border-radius: 26px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); padding: 20px; }
.board-header { display:flex; align-items:flex-end; justify-content:space-between; gap: 16px; margin-bottom: 18px; }
.board-actions { display:flex; gap:10px; flex-wrap:wrap; }
.tile-board { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; grid-auto-flow: dense; }
.tile-card { position:relative; border-radius: 28px; aspect-ratio: 1 / 1; min-height: 0; padding: 18px; overflow:hidden; border: 1px solid rgba(255,255,255,0.08); cursor: pointer; transition: transform .22s ease, box-shadow .22s ease, opacity .18s ease; display:flex; flex-direction:column; justify-content:space-between; outline: none; }
.tile-card:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 18px 55px rgba(0,0,0,0.28); }
.tile-card:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,0.2), 0 0 0 6px rgba(111,227,181,0.3); }
.tile-card.focus { grid-column: 1 / span 2; grid-row: span 2; aspect-ratio: auto; min-height: 100%; }
.tile-card.medium, .tile-card.small { min-height: 0; }
.tile-card.dragging { opacity: 0.45; }
.tile-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.tile-icon { width: 52px; height: 52px; border-radius: 18px; background: rgba(255,255,255,0.17); display:grid; place-items:center; font-size: 25px; }
.tile-menu { background: rgba(255,255,255,0.14); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 12px; cursor: pointer; transition: background .18s; }
.tile-menu:hover { background: rgba(255,255,255,0.28); }
.tile-title { font-size: 1.35rem; font-weight: 700; margin: 12px 0 6px; }
.tile-card.focus .tile-title { font-size: 2rem; }
.tile-subtitle { color: rgba(255,255,255,0.86); font-size: 0.92rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tile-desc, .tile-meta, .muted { color: rgba(255,255,255,0.78); }
.tile-support { color: rgba(255,255,255,0.82); font-size: 0.95rem; line-height: 1.45; }
.tile-focus-extra { margin-top: 12px; display:grid; gap: 8px; }
.tile-progress { margin-top: 14px; }
.tile-status-line { display:flex; justify-content:space-between; align-items:center; gap: 10px; font-size: 0.82rem; color: rgba(255,255,255,0.85); margin-top: 10px; }
.tile-actions { display:flex; justify-content:flex-end; margin-top: 12px; }
.progress-bar { width:100%; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.18); overflow:hidden; }
.progress-bar > span { display:block; height:100%; border-radius:inherit; background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.55)); }
.tile-footer { display:flex; justify-content:space-between; align-items:center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.badge { border-radius: 999px; padding: 7px 10px; background: rgba(17,23,41,0.24); border: 1px solid rgba(255,255,255,0.16); font-size: 0.82rem; }
.focus-detail-card { min-width: 0; }
.editor-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 18px 0; }
.section-card { padding: 22px; }
.section-title-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom: 18px; }
.section-title { font-size: 1.4rem; font-weight: 700; }
.task-group-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom: 10px; }
.subtile-list { display:grid; gap: 12px; }
.subtile-item { border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.03); border-radius: 18px; padding: 14px; display:grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items:flex-start; }
.subtile-item.done { opacity: 0.68; }
.check { width: 22px; height: 22px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.06); display:grid; place-items:center; cursor:pointer; margin-top:2px; flex-shrink: 0; transition: background .18s, border-color .18s; }
.check:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.5); }
.check.done { background: rgba(111,227,181,0.22); border-color: rgba(111,227,181,0.8); }
.subtile-title { font-weight: 600; margin-bottom: 6px; }
.subtile-notes { color: var(--muted); font-size: 0.92rem; }
.rightbar { padding: 20px; position: sticky; top: 24px; }
.event-card { padding: 20px; }
.event-list { display:grid; gap: 10px; margin-bottom: 16px; }
.event-chip { display:flex; gap:10px; align-items:flex-start; color: #d9e0f0; }
.dot { width: 12px; height: 12px; border-radius:50%; margin-top: 5px; }
.voice-box { border-radius: 18px; padding: 16px; background: linear-gradient(180deg, rgba(111,227,181,0.1), rgba(90,125,255,0.08)); border: 1px solid rgba(111,227,181,0.14); margin-bottom: 16px; }
.voice-wave { height: 58px; border-radius: 12px; background: repeating-linear-gradient(90deg, rgba(111,227,181,0.1) 0 6px, transparent 6px 12px), linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)); margin: 10px 0 14px; position: relative; overflow: hidden; }
.voice-wave::after { content:''; position:absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(111,227,181,0.35), transparent); animation: sweep 2.2s infinite; }
@keyframes sweep { from { transform: translateX(-100%);} to { transform: translateX(100%);} }
.calendar-grid { display:grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 10px; }
.calendar-head, .calendar-day { border-radius: 16px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); padding: 10px; min-height: 96px; }
.calendar-head { min-height: auto; text-align:center; color: var(--muted); font-size: 0.85rem; }
.calendar-day.today { outline: 2px solid rgba(111,227,181,0.4); }
.calendar-task { margin-top: 8px; font-size: 0.78rem; border-radius: 999px; padding: 5px 8px; background: rgba(111,227,181,0.12); color: #d6fff0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* tile subpage panel: no inner padding – task view header handles it */
#tileSubpagePanel.section-card { padding: 0; overflow: hidden; }

/* ── Task view (replaces tile grid when tile is opened) ──────────────── */
.task-view-header { border-radius: 22px 22px 0 0; padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.task-view-back { display: flex; justify-content: space-between; align-items: center; }
.task-back-btn { padding: 8px 16px; font-size: 0.88rem; }
.task-view-hero { display: flex; align-items: center; gap: 14px; }
.task-view-title { font-size: 1.8rem; font-weight: 800; color: #fff; line-height: 1.1; }
.task-view-sub { color: rgba(255,255,255,0.82); font-size: 0.92rem; margin-top: 4px; }
.task-view-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.task-stat { background: rgba(0,0,0,0.18); border-radius: 14px; padding: 12px 14px; }
.task-stat-val { font-size: 1.35rem; font-weight: 700; color: #fff; line-height: 1; }
.task-stat-lbl { font-size: 0.72rem; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 4px; }
.task-stat-next .task-stat-val { font-size: 0.95rem; line-height: 1.3; }
@media (max-width: 640px) { .task-view-stats { grid-template-columns: repeat(2, 1fr); } .task-view-title { font-size: 1.4rem; } }

/* ── COG button next to tile detail hint ──────────────────────────────── */
.cog-btn { border: 0; border-radius: 14px; width: 40px; height: 40px; background: rgba(255,255,255,0.08); color: var(--text); cursor: pointer; font-size: 1.15rem; display: inline-grid; place-items: center; transition: background .18s, transform .18s; flex-shrink: 0; }
.cog-btn:hover { background: rgba(111,227,181,0.18); transform: rotate(22deg) scale(1.08); }

/* ── Config panel overlay ─────────────────────────────────────────────── */
.config-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: flex-end; background: rgba(5,8,20,0.62); backdrop-filter: blur(6px); padding: 24px; opacity: 0; transition: opacity .26s ease; }
.config-overlay.config-visible { opacity: 1; }
.config-overlay.hidden { display: none !important; }

/* ── Config sliding panel ─────────────────────────────────────────────── */
.config-panel { width: 420px; max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); overflow-y: auto; background: #0e1425; border: 1px solid rgba(255,255,255,0.12); border-radius: 28px; box-shadow: 0 32px 100px rgba(0,0,0,0.7); padding: 26px; display: flex; flex-direction: column; gap: 0; transform: translateX(32px); transition: transform .26s cubic-bezier(.22,1,.36,1); }
.config-overlay.config-visible .config-panel { transform: translateX(0); }

/* ── Config panel header ─────────────────────────────────────────────── */
.config-panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.config-panel-title { font-size: 1.5rem; font-weight: 700; }
.config-panel-sub { color: var(--muted); font-size: 0.82rem; margin-top: 4px; max-width: 300px; line-height: 1.4; }
.config-close-btn { border: 0; border-radius: 12px; width: 36px; height: 36px; background: rgba(255,255,255,0.07); color: var(--text); cursor: pointer; font-size: 1rem; display: grid; place-items: center; flex-shrink: 0; transition: background .18s; }
.config-close-btn:hover { background: rgba(249,115,115,0.22); color: #ffd0d0; }

/* ── Section label inside the config panel ───────────────────────────── */
.config-section-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin-bottom: 14px; }

/* ── focus-detail-layout: now single column (editor card removed) ─────── */
.focus-detail-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* ── Responsive: keep panel sensible on small screens ────────────────── */
@media (max-width: 640px) { .config-panel { width: 100%; max-width: 100%; border-radius: 24px 24px 0 0; } .config-overlay { align-items: flex-end; padding: 0; } }

/* ── Icon/action buttons for subtile rows ─────────────────────────────── */
.btn-icon { border: 0; border-radius: 10px; width: 30px; height: 30px; background: rgba(255,255,255,0.10); color: var(--text); cursor: pointer; display: inline-grid; place-items: center; font-size: 0.85rem; transition: background .18s ease, transform .18s ease; padding: 0; flex-shrink: 0; }
.btn-icon:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.btn-icon-danger:hover { background: rgba(249,115,115,0.28); }

/* ── Tile card state: currently being edited ─────────────────────────── */
.tile-card.tile-editing { outline: 2px solid rgba(111,227,181,0.6); box-shadow: 0 0 0 4px rgba(111,227,181,0.12), 0 18px 55px rgba(0,0,0,0.28); }

/* ── Open tile button inside tile footer ─────────────────────────────── */
.tile-open-btn { cursor: pointer; border: 0; background: rgba(17,23,41,0.36); color: #fff; }
.tile-open-btn:hover { background: rgba(111,227,181,0.22); color: #d3ffef; }

/* ── Error / warning notice variant ─────────────────────────────────── */
.notice-error { background: rgba(249,115,115,0.10); border-color: rgba(249,115,115,0.32); color: #ffd0d0; }

.hidden { display:none !important; }
/* ── Task List Panel (All / This Week views) ─────────────────────────── */
#taskListPanel { display: grid; gap: 14px; }
.tl-empty { color: var(--muted); text-align: center; padding: 28px 0; font-size: 1rem; }
.tl-group { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 20px; overflow: hidden; }
.tl-group-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.tl-tile-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tl-tile-icon { font-size: 1.1rem; line-height: 1; }
.tl-tile-name { font-weight: 700; font-size: 1rem; flex: 1; }
.tl-tile-count { font-size: 0.78rem; color: var(--muted); background: rgba(255,255,255,0.06); border-radius: 999px; padding: 3px 10px; }
.tl-tasks { display: grid; }
.tl-task { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px 18px; border-bottom: 1px solid rgba(255,255,255,0.04); transition: background .15s; }
.tl-task:last-child { border-bottom: none; }
.tl-task:hover { background: rgba(255,255,255,0.025); }
.tl-task.done { opacity: 0.5; }
.tl-task-body { min-width: 0; }
.tl-task-title { font-weight: 600; font-size: 0.95rem; }
.tl-task.done .tl-task-title { text-decoration: line-through; }
.tl-task-notes { color: var(--muted); font-size: 0.82rem; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-task-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.badge-overdue { background: rgba(249,115,115,0.15); border-color: rgba(249,115,115,0.4); color: #ffc0c0; }
.badge-muted { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); color: var(--muted); }
/* ── Inline task editor row ──────────────────────────────────────────── */
.inline-edit-row { display: block !important; padding: 14px 18px; background: rgba(111,227,181,0.04); border-left: 3px solid rgba(111,227,181,0.4); }
.inline-edit-fields { display: grid; gap: 8px; margin-bottom: 10px; }
.inline-edit-fields input { width: 100%; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); color: var(--text); padding: 9px 12px; font: inherit; font-size: 0.9rem; outline: none; }
.inline-edit-fields input:focus { border-color: rgba(111,227,181,0.6); box-shadow: 0 0 0 3px rgba(111,227,181,0.1); }
.inline-edit-actions { display: flex; gap: 8px; }

.auth-state { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.associate-list { display:grid; gap:8px; }
.associate-item { display:flex; justify-content:space-between; gap:8px; border-radius: 14px; padding: 10px 12px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
.notice { padding: 12px 14px; border-radius: 14px; background: rgba(111,227,181,0.08); border: 1px solid rgba(111,227,181,0.18); color: #d3ffef; margin-bottom: 12px; }
.empty { color: var(--muted); padding: 16px 0; text-align:center; }
.small { font-size: 0.82rem; }

/* ── Accordion toggle (Add Event collapsible header) ─────────────────── */
.accordion-toggle { width: 100%; text-align: left; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 14px; padding: 12px 14px; cursor: pointer; color: var(--text); font-size: 0.97rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; transition: background .18s; }
.accordion-toggle:hover { background: rgba(255,255,255,0.08); }
.accordion-arrow { font-size: 0.82rem; opacity: 0.7; transition: transform .18s; }

/* ── Recent-task chips (right sidebar) ───────────────────────────────── */
.recent-task-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); margin-bottom: 6px; overflow: hidden; }
.recent-task-chip.done { opacity: 0.45; }
.recent-task-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #76f2bc; }
.recent-task-text { flex: 1; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-task-tile { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

@media (max-width: 1220px) { .app-shell { grid-template-columns: 280px 1fr; } .rightbar { grid-column: span 2; position: static; } }
@media (max-width: 900px) { body { padding: 14px; } .app-shell { grid-template-columns: 1fr; } .sidebar, .rightbar { position: static; } .tile-board, .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile-card.focus { grid-column: span 2; grid-row: span 1; aspect-ratio: 2 / 1; } .board-header { flex-direction: column; align-items: stretch; } }
@media (max-width: 640px) { .topbar { flex-direction: column; align-items: stretch; } .tile-board, .summary-strip { grid-template-columns: 1fr; } .tile-card, .tile-card.focus { grid-column: span 1; grid-row: span 1; aspect-ratio: 1 / 1; min-height: 0; } .calendar-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
