@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #111a2b;
  --panel2: #151f32;
  --line: #26334a;
  --text: #eaf0f7;
  --muted: #91a0b5;
  --teal: #48d1bd;
  --teal-glow: rgba(72, 209, 189, 0.15);
  --blue: #6f9cff;
  --blue-glow: rgba(111, 156, 255, 0.15);
  --green: #69d7a2;
  --red: #ff7885;
  --amber: #f4c96c;
  --amber-glow: rgba(244, 201, 108, 0.15);
  --shadow: 0 15px 50px rgba(5, 9, 20, 0.45);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 'DM Sans', 'Noto Sans JP', sans-serif;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(72, 209, 189, 0.1), transparent 55%),
    var(--bg);
}

.auth-card {
  width: min(100%, 430px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card > .brand-mark {
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 0 0 8px;
}

.auth-card > p {
  color: var(--muted);
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.auth-field input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
}

.auth-field input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.auth-message {
  min-height: 1.5em;
  margin: 12px 0;
  color: var(--muted);
}

.auth-error {
  color: var(--red) !important;
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #0e1525;
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #61e0ca, #278e9c);
  display: grid;
  place-items: center;
  color: #071522;
  font-weight: 800;
}

.brand small, .profile small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.profile {
  padding: 14px;
  border: 1px solid var(--line);
  background: #121c2c;
  border-radius: 14px;
  display: flex;
  gap: 11px;
  align-items: center;
}

.avatar {
  height: 36px;
  width: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #263b50;
  color: var(--teal);
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  background: transparent;
  border-radius: 10px;
  text-align: left;
  padding: 12px 13px;
  color: #a7b5c8;
  display: flex;
  gap: 13px;
  align-items: center;
  transition: all 0.2s ease;
}

.nav-item span {
  width: 20px;
  font-size: 18px;
  color: #7f91a7;
  text-align: center;
}

.nav-item:hover, .nav-item.active {
  background: #18273a;
  color: #eaf6f4;
}

.nav-item.active {
  box-shadow: inset 3px 0 var(--teal);
}

.nav-item.active span {
  color: var(--teal);
}

.sidebar-note {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  padding: 10px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 8px;
}

.main {
  min-width: 0;
  max-width: 1600px;
  margin: auto;
  width: 100%;
  padding: 28px 38px 60px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 26px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .13em;
  color: var(--teal);
  font-weight: 700;
}

h1 {
  font-size: 25px;
  margin: 3px 0 0;
}

h2 {
  font-size: 17px;
  margin: 0 0 5px;
}

h3 {
  font-size: 14px;
  margin: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 14px;
  background: #182438;
  color: var(--text);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.button:hover {
  border-color: #527480;
  background: #20304a;
}

.button.primary {
  background: var(--teal);
  color: #08201e;
  border-color: var(--teal);
  font-weight: 700;
}

.button.primary:hover {
  background: #5fe0ce;
  border-color: #5fe0ce;
}

.button.amber {
  background: var(--amber);
  color: #2b1f06;
  border-color: var(--amber);
  font-weight: 700;
}

.button.amber:hover {
  background: #f7d68b;
  border-color: #f7d68b;
}

.button.ghost {
  background: transparent;
}

.button.ghost:hover {
  background: #162235;
}

.button.danger {
  color: var(--red);
}

.button.danger:hover {
  border-color: var(--red);
  background: rgba(255, 120, 133, 0.1);
}

.button.active {
  background: var(--teal-glow);
  color: var(--teal);
  border-color: var(--teal);
}

.view {
  display: grid;
  gap: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid #1b2940;
  border-radius: 15px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 15px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.metric {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.25;
  margin: 8px 0;
}

.metric small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 4px;
}

.metric-sub {
  font-size: 11px;
  color: var(--muted);
}

.metric.teal { color: var(--teal); }
.metric.blue { color: #90b1ff; }
.metric.green { color: var(--green); }
.metric.amber { color: var(--amber); }

.badge {
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #a6b8cf;
  background: #1b2a3e;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge.good {
  background: rgba(105, 215, 162, 0.15);
  color: var(--green);
}

.badge.warning {
  background: rgba(244, 201, 108, 0.15);
  color: var(--amber);
}

.badge.teal {
  background: var(--teal-glow);
  color: var(--teal);
}

.badge.amber {
  background: var(--amber-glow);
  color: var(--amber);
}

.badge.blue {
  background: var(--blue-glow);
  color: var(--blue);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.85fr);
  gap: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

input, select, textarea {
  background: #0d1524;
  border: 1px solid #2a3a52;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline input {
  width: auto;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #223048;
  font-size: 12px;
}

th {
  color: var(--muted);
  font-weight: 500;
}

td strong {
  font-weight: 600;
}

.empty {
  padding: 38px 15px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #31415a;
  border-radius: 12px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
}

.task-row > .task-select {
  flex: 0 0 auto;
  width: auto;
  margin: 4px 0 0;
  padding: 0;
}

.task-details {
  flex: 1;
  min-width: 0;
}

.task-details > strong {
  overflow-wrap: anywhere;
}

.task-details > .muted {
  margin-top: 3px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.task-status-select {
  width: auto;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
}

.task-priority-select {
  width: auto;
  padding: 4px 8px;
  font-size: 11px;
}

.task-priority-select.priority-high { color: var(--red); }
.task-priority-select.priority-medium { color: var(--amber); }
.task-priority-select.priority-low { color: var(--teal); }

.task-due-date {
  width: 140px;
  padding: 4px 8px;
  font-size: 11px;
}

.task-date-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.task-status-select.status-todo { color: var(--muted); }
.task-status-select.status-in-progress { color: var(--blue); }
.task-status-select.status-done { color: var(--green); }

.task-meta .badge.danger {
  color: var(--red);
  background: rgba(255, 120, 133, 0.15);
}

.task-overdue {
  color: var(--red);
  font-weight: 600;
}

.task-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.task-filters {
  margin-bottom: 14px;
}

.task-row.is-complete .task-details > strong {
  color: var(--muted);
  text-decoration: line-through;
}

/* Charts */
.bar-chart {
  height: 210px;
  display: flex;
  gap: 6px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 12px 4px 0;
  overflow-x: auto;
}

.bar-col {
  flex: 1;
  min-width: 14px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  height: 100%;
  gap: 6px;
}

.bar {
  width: min(28px, 85%);
  min-height: 2px;
  background: linear-gradient(0deg, #2a8c93, #55dcc6);
  border-radius: 5px 5px 0 0;
  transition: height 0.3s ease;
}

.bar-col span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.progress {
  height: 8px;
  background: #202e42;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: 8px;
  transition: width 0.3s ease;
}

.progress i.green { background: var(--green); }
.progress i.amber { background: var(--amber); }

.subject-row {
  display: grid;
  grid-template-columns: 120px minmax(60px, 1fr) 60px 45px;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  padding: 6px 0;
}

.subject-row .progress {
  margin: 0;
}

.subject-row strong {
  text-align: right;
}

/* =========================================
   Heatmap (Calendar & Habit)
   ========================================= */

.heatmap-card {
  overflow: hidden;
}

.heatmap-container {
  width: 100%;
  padding: 8px 0;
  overflow-x: auto;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  padding: 4px 0;
}

/* Weekly view: 7 columns across full width */
.heatmap.weekly {
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

/* Extended view (60+ days): compact yet easily clickable */
.heatmap.extended {
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
}

.heat-cell {
  aspect-ratio: 1;
  min-height: 52px;
  border-radius: 8px;
  background: #131d2c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.heatmap.extended .heat-cell {
  min-height: 38px;
  padding: 4px;
  border-radius: 6px;
}

.heat-cell:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 5;
  border-color: rgba(255, 255, 255, 0.35);
}

.heat-cell.is-today {
  border: 2px solid var(--accent);
  box-shadow: 0 0 10px rgba(72, 209, 189, 0.35);
}

.heat-cell-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}

.heat-cell-time {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  align-self: flex-end;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.heatmap.extended .heat-cell-date {
  font-size: 10px;
}
.heatmap.extended .heat-cell-time {
  font-size: 9px;
}

/* Heatmap Levels - Multi-theme Palettes */
.heat-cell[data-level="0"] {
  background: #131d2c;
  border-color: rgba(255, 255, 255, 0.08);
}

.heat-cell.is-future {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px dashed rgba(255, 255, 255, 0.08) !important;
  cursor: default;
  opacity: 0.35;
}
.heat-cell.is-future:hover {
  transform: none;
  box-shadow: none;
}

/* Over-limit cells glow like a small flame. */
.heat-cell.is-burning {
  background: radial-gradient(circle at 50% 38%, #fff6bd 0%, #ffd45c 36%, #ff9f2d 72%, #f06a24 100%) !important;
  border-color: #ffe28a !important;
  color: #fff;
  animation: heatmap-burning 1.15s ease-in-out infinite alternate;
  z-index: 1;
}

.heat-cell.is-burning .heat-cell-date,
.heat-cell.is-burning .heat-cell-time {
  color: #fff;
  text-shadow: 0 1px 4px rgba(92, 24, 0, 0.9);
}

.heat-sample.is-burning {
  background: radial-gradient(circle at 50% 38%, #fff6bd 0%, #ffd45c 36%, #ff9f2d 72%, #f06a24 100%);
  border-color: #ffe28a;
  animation: heatmap-burning 1.15s ease-in-out infinite alternate;
}

@keyframes heatmap-burning {
  0% {
    box-shadow: 0 0 9px rgba(255, 166, 45, 0.8), 0 0 20px rgba(255, 126, 35, 0.5);
  }
  100% {
    box-shadow: 0 0 17px rgba(255, 226, 138, 1), 0 0 36px rgba(255, 145, 35, 0.9);
  }
}

/* --- Theme: Teal (Default) --- */
.heatmap[data-theme="teal"] .heat-cell[data-level="1"], .heat-sample[data-theme="teal"][data-level="1"] { background: #133833; border-color: #1b524b; }
.heatmap[data-theme="teal"] .heat-cell[data-level="2"], .heat-sample[data-theme="teal"][data-level="2"] { background: #174e47; border-color: #1f6b61; }
.heatmap[data-theme="teal"] .heat-cell[data-level="3"], .heat-sample[data-theme="teal"][data-level="3"] { background: #1b6d61; border-color: #248b7c; }
.heatmap[data-theme="teal"] .heat-cell[data-level="4"], .heat-sample[data-theme="teal"][data-level="4"] { background: #258c7f; border-color: #35b7a4; }
.heatmap[data-theme="teal"] .heat-cell[data-level="5"], .heat-sample[data-theme="teal"][data-level="5"] { background: #35b7a4; border-color: #5ce3ce; }
.heatmap[data-theme="teal"] .heat-cell[data-level="6"], .heat-sample[data-theme="teal"][data-level="6"] { background: #48d1bd; border-color: #7ef2e0; }

/* --- Theme: Blue --- */
.heatmap[data-theme="blue"] .heat-cell[data-level="1"], .heat-sample[data-theme="blue"][data-level="1"] { background: #112842; border-color: #183b61; }
.heatmap[data-theme="blue"] .heat-cell[data-level="2"], .heat-sample[data-theme="blue"][data-level="2"] { background: #14375c; border-color: #1a4d80; }
.heatmap[data-theme="blue"] .heat-cell[data-level="3"], .heat-sample[data-theme="blue"][data-level="3"] { background: #194a7a; border-color: #2164a6; }
.heatmap[data-theme="blue"] .heat-cell[data-level="4"], .heat-sample[data-theme="blue"][data-level="4"] { background: #1f64a4; border-color: #2d85d8; }
.heatmap[data-theme="blue"] .heat-cell[data-level="5"], .heat-sample[data-theme="blue"][data-level="5"] { background: #2f81d1; border-color: #5aa7f2; }
.heatmap[data-theme="blue"] .heat-cell[data-level="6"], .heat-sample[data-theme="blue"][data-level="6"] { background: #489bf2; border-color: #8ac4ff; }

/* --- Theme: Green --- */
.heatmap[data-theme="green"] .heat-cell[data-level="1"], .heat-sample[data-theme="green"][data-level="1"] { background: #12301f; border-color: #1a452d; }
.heatmap[data-theme="green"] .heat-cell[data-level="2"], .heat-sample[data-theme="green"][data-level="2"] { background: #15422a; border-color: #1d5c3b; }
.heatmap[data-theme="green"] .heat-cell[data-level="3"], .heat-sample[data-theme="green"][data-level="3"] { background: #195b39; border-color: #237a4d; }
.heatmap[data-theme="green"] .heat-cell[data-level="4"], .heat-sample[data-theme="green"][data-level="4"] { background: #207a4c; border-color: #2ba265; }
.heatmap[data-theme="green"] .heat-cell[data-level="5"], .heat-sample[data-theme="green"][data-level="5"] { background: #2ba265; border-color: #4ed38f; }
.heatmap[data-theme="green"] .heat-cell[data-level="6"], .heat-sample[data-theme="green"][data-level="6"] { background: #3ecf82; border-color: #72f5ae; }

/* --- Theme: Purple --- */
.heatmap[data-theme="purple"] .heat-cell[data-level="1"], .heat-sample[data-theme="purple"][data-level="1"] { background: #26163b; border-color: #372054; }
.heatmap[data-theme="purple"] .heat-cell[data-level="2"], .heat-sample[data-theme="purple"][data-level="2"] { background: #351c52; border-color: #4b2675; }
.heatmap[data-theme="purple"] .heat-cell[data-level="3"], .heat-sample[data-theme="purple"][data-level="3"] { background: #4a2575; border-color: #65339e; }
.heatmap[data-theme="purple"] .heat-cell[data-level="4"], .heat-sample[data-theme="purple"][data-level="4"] { background: #62309c; border-color: #8240ce; }
.heatmap[data-theme="purple"] .heat-cell[data-level="5"], .heat-sample[data-theme="purple"][data-level="5"] { background: #7c3dc5; border-color: #a45df5; }
.heatmap[data-theme="purple"] .heat-cell[data-level="6"], .heat-sample[data-theme="purple"][data-level="6"] { background: #9a53f0; border-color: #c48dfc; }

/* --- Theme: Monochrome (Mono) --- */
.heatmap[data-theme="mono"] .heat-cell[data-level="1"], .heat-sample[data-theme="mono"][data-level="1"] { background: #1e2633; border-color: #293445; }
.heatmap[data-theme="mono"] .heat-cell[data-level="2"], .heat-sample[data-theme="mono"][data-level="2"] { background: #2a3447; border-color: #39475f; }
.heatmap[data-theme="mono"] .heat-cell[data-level="3"], .heat-sample[data-theme="mono"][data-level="3"] { background: #3d4b63; border-color: #4e5f7c; }
.heatmap[data-theme="mono"] .heat-cell[data-level="4"], .heat-sample[data-theme="mono"][data-level="4"] { background: #556684; border-color: #6d82a6; }
.heatmap[data-theme="mono"] .heat-cell[data-level="5"], .heat-sample[data-theme="mono"][data-level="5"] { background: #7186aa; border-color: #92a8cc; }
.heatmap[data-theme="mono"] .heat-cell[data-level="6"], .heat-sample[data-theme="mono"][data-level="6"] { background: #96acd1; border-color: #bdd0ee; }

/* Text contrast for high levels */
.heatmap .heat-cell[data-level="5"] .heat-cell-date,
.heatmap .heat-cell[data-level="6"] .heat-cell-date,
.heatmap .heat-cell[data-level="4"] .heat-cell-date {
  color: #0b1522;
  font-weight: 800;
}
.heatmap .heat-cell[data-level="5"] .heat-cell-time,
.heatmap .heat-cell[data-level="6"] .heat-cell-time,
.heatmap .heat-cell[data-level="4"] .heat-cell-time {
  color: #0b1522;
  text-shadow: none;
}

/* Legend Bar */
.heat-legend-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.heat-legend-title {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

.heat-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.heat-legend-gradient {
  display: inline-block;
  width: 180px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.heat-sample {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.heat-sample[data-level="0"] { background: #131d2c; }

/* Heatmap Config Box */
.heatmap-config-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

/* =========================================
   Timer UI & Switcher (Pomodoro, Countdown, Stopwatch)
   ========================================= */

.timer-switcher {
  display: flex;
  background: #0d1626;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 18px;
  gap: 4px;
  width: 100%;
  max-width: 480px;
}

.timer-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.timer-tab-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.timer-tab-btn.active {
  background: var(--teal);
  color: #0b1522;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(72, 209, 189, 0.35);
}

.timer-tab-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 14px 0;
}

.preset-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.preset-chip.active {
  background: var(--teal-glow);
  border-color: var(--teal);
  color: var(--teal);
}

/* Break Choice Alert Box (Pomodoro 4 sets) */
.break-choice-panel {
  background: linear-gradient(180deg, #18283e 0%, #111e30 100%);
  border: 1px solid var(--amber);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
  box-shadow: 0 4px 16px rgba(244, 201, 108, 0.15);
  animation: pulse-border 2s infinite ease-in-out;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(244, 201, 108, 0.6); }
  50% { border-color: rgba(244, 201, 108, 1); }
}

.break-choice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 8px;
}

.break-choice-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* =========================================
   Pomodoro Circular Timer UI
   ========================================= */

.pomodoro-card {
  text-align: center;
  padding: 28px 20px;
  background: linear-gradient(180deg, #121e33 0%, #0d1626 100%);
  border: 1px solid #1f3350;
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pomodoro-card.mode-work {
  border-color: #29535b;
  box-shadow: 0 0 35px rgba(72, 209, 189, 0.08);
}

.pomodoro-card.mode-shortBreak {
  border-color: #554422;
  box-shadow: 0 0 35px rgba(244, 201, 108, 0.08);
}

.pomodoro-card.mode-longBreak {
  border-color: #2b3e64;
  box-shadow: 0 0 35px rgba(111, 156, 255, 0.08);
}

.pomodoro-circle-wrap {
  position: relative;
  width: min(270px, 80vw);
  height: min(270px, 80vw);
  margin: 16px auto;
  display: grid;
  place-items: center;
}

.pomodoro-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: #162338;
  stroke-width: 10;
}

.circle-progress {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s linear, stroke 0.3s ease;
}

.mode-work .circle-progress {
  stroke: var(--teal);
  filter: drop-shadow(0 0 8px rgba(72, 209, 189, 0.4));
}

.mode-shortBreak .circle-progress {
  stroke: var(--amber);
  filter: drop-shadow(0 0 8px rgba(244, 201, 108, 0.4));
}

.mode-longBreak .circle-progress {
  stroke: var(--blue);
  filter: drop-shadow(0 0 8px rgba(111, 156, 255, 0.4));
}

.pomodoro-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.pomodoro-mode-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.mode-work .pomodoro-mode-badge {
  background: var(--teal-glow);
  color: var(--teal);
  border: 1px solid #31726a;
}

.mode-shortBreak .pomodoro-mode-badge {
  background: var(--amber-glow);
  color: var(--amber);
  border: 1px solid #775f28;
}

.mode-longBreak .pomodoro-mode-badge {
  background: var(--blue-glow);
  color: var(--blue);
  border: 1px solid #395286;
}

.pomodoro-time {
  font-size: 58px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.1;
  color: var(--text);
}

.pomodoro-set-info {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pomodoro-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pomodoro-controls .button {
  padding: 10px 18px;
  font-size: 13px;
}

.pomodoro-session-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  background: #101a2a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--text);
  border-color: #3b506f;
}

.tab.active {
  color: var(--teal);
  border-color: #316e6b;
  background: var(--teal-glow);
}

/* Callout, Toast, Dialog */
.callout {
  border: 1px solid #28534f;
  background: #102a2a;
  padding: 13px 16px;
  border-radius: 10px;
  color: #b6dcd5;
  font-size: 12px;
}

.callout.info {
  border-color: #283e5f;
  background: #111d2d;
  color: #b5cbe8;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #19352f;
  color: var(--green);
  padding: 13px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #2d6b5e;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  width: min(580px, calc(100% - 32px));
  padding: 24px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(5, 9, 20, 0.75);
  backdrop-filter: blur(2px);
}

dialog form {
  display: grid;
  gap: 16px;
}

#modal-content {
  display: grid;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.notice {
  color: var(--amber);
  font-size: 11px;
}

/* Weekday Chart */
.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  text-align: center;
  padding: 12px 0 0;
}

.weekday-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.weekday-bar-track {
  height: 120px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.weekday-bar {
  width: 24px;
  background: linear-gradient(0deg, #24757c, #48d1bd);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.weekday-name {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.weekday-mins {
  font-size: 10px;
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 1050px) {
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .main { padding: 24px; }
}

@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar {
    height: auto;
    position: relative;
    padding: 12px;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand small, .profile, .sidebar-note { display: none; }
  #nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
  }
  .nav-item {
    white-space: nowrap;
    padding: 8px 10px;
    font-size: 11px;
    gap: 5px;
  }
  .nav-item span { font-size: 14px; width: auto; }
  .main { padding: 18px 14px 40px; }
  .topbar {
    align-items: flex-start;
    gap: 12px;
  }
  .top-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  .top-actions .button { padding: 8px 10px; }
  h1 { font-size: 21px; }
  .grid.three, .grid.two { grid-template-columns: 1fr; }
  .grid.four { gap: 9px; }
  .card { padding: 16px; }
  .metric { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .pomodoro-time { font-size: 46px; }
  .subject-row {
    grid-template-columns: 80px minmax(50px, 1fr) 50px 35px;
    font-size: 11px;
  }
  .task-row { flex-wrap: wrap; }
  .task-row > .task-details { flex-basis: calc(100% - 32px); }
  .task-row.is-draggable > .task-details { flex-basis: calc(100% - 60px); }
  .task-actions { margin-left: auto; }
}

/* =========================================
   Cloud Sync Status Indicator & UI
   ========================================= */

.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.auto-launch-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
}

.auto-launch-days label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.auto-launch-days input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.sync-status-badge:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
  flex-shrink: 0;
}

/* Status variants */
.sync-status-badge.status-synced {
  color: var(--teal);
  border-color: rgba(72, 209, 189, 0.35);
  background: rgba(72, 209, 189, 0.08);
}
.sync-status-badge.status-synced .sync-dot {
  background: var(--teal);
  box-shadow: 0 0 8px rgba(72, 209, 189, 0.6);
}

.sync-status-badge.status-syncing {
  color: var(--blue);
  border-color: rgba(111, 156, 255, 0.35);
  background: rgba(111, 156, 255, 0.08);
}
.sync-status-badge.status-syncing .sync-dot {
  background: var(--blue);
  animation: sync-pulse 1s infinite alternate;
}

@keyframes sync-pulse {
  0% { transform: scale(0.7); opacity: 0.4; }
  100% { transform: scale(1.3); opacity: 1; }
}

.sync-status-badge.status-pending {
  color: var(--amber);
  border-color: rgba(244, 201, 108, 0.35);
  background: rgba(244, 201, 108, 0.08);
}
.sync-status-badge.status-pending .sync-dot {
  background: var(--amber);
}

.sync-status-badge.status-offline {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}
.sync-status-badge.status-offline .sync-dot {
  background: #64748b;
}

.sync-status-badge.status-error {
  color: var(--red);
  border-color: rgba(255, 120, 133, 0.35);
  background: rgba(255, 120, 133, 0.08);
}
.sync-status-badge.status-error .sync-dot {
  background: var(--red);
}

.sync-status-badge.status-disabled {
  opacity: 0.75;
}

/* Sync button spinning state */
.button.is-spinning {
  pointer-events: none;
  opacity: 0.8;
}

.button.is-spinning::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  margin-left: 6px;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

.task-kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.task-kanban-column {
  min-width: 240px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
}

.task-kanban .task-row {
  flex-wrap: wrap;
}

.task-kanban .task-row > .task-details {
  flex-basis: calc(100% - 60px);
}

.task-kanban .task-row > .task-actions {
  margin-left: auto;
}

.task-kanban-column h3,
.schedule-day-head {
  margin: 0 0 10px;
  padding: 8px;
  color: var(--text);
  font-size: 13px;
}

.task-calendar-toolbar,
.task-schedule-toolbar,
.planner-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.task-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.task-calendar-weekday,
.task-calendar-cell {
  min-height: 100px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.task-calendar-weekday {
  min-height: 0;
  color: var(--muted);
  text-align: center;
}

.task-calendar-cell.is-empty { background: rgba(0, 0, 0, 0.12); }
.task-calendar-cell.is-today { box-shadow: inset 0 0 0 2px var(--teal); }
.task-calendar-cell.has-conflict { background: rgba(255, 120, 133, 0.09); }

.calendar-task,
.schedule-task {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  margin-top: 5px;
  padding: 4px;
  border-radius: 6px;
  background: var(--panel2);
}

.task-calendar-item,
.schedule-task > button:not(.task-drag-handle) {
  min-width: 0;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  overflow-wrap: anywhere;
}

.schedule-conflict-count,
.schedule-task.is-conflicted,
.calendar-task.is-conflicted {
  color: var(--red);
  background: rgba(255, 120, 133, 0.16);
}

.schedule-conflict-count {
  display: inline-block;
  margin: 4px 0;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 10px;
}

.schedule-conflict-panel {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 120, 133, 0.55);
  border-radius: 8px;
  color: var(--red);
  background: rgba(255, 120, 133, 0.08);
}

.schedule-conflict-panel ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.task-schedule-scroll { overflow-x: auto; }

.task-schedule-grid {
  display: grid;
  grid-template-columns: 54px repeat(7, minmax(130px, 1fr));
  min-width: 1000px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.task-schedule-grid.is-day {
  grid-template-columns: 54px minmax(220px, 1fr);
  min-width: 0;
}

.schedule-day-head,
.schedule-hour,
.task-schedule-slot {
  margin: 0;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-hour {
  color: var(--muted);
  font-size: 11px;
}

.task-schedule-slot {
  min-height: 68px;
  background: rgba(255, 255, 255, 0.015);
}

.task-schedule-slot.has-conflict { background: rgba(255, 120, 133, 0.12); }

.schedule-unscheduled {
  margin-top: 14px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.schedule-unscheduled > div { display: flex; flex-wrap: wrap; gap: 8px; }
.task-drag-handle {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.task-drag-handle:active { cursor: grabbing; }
.drop-target { outline: 2px dashed var(--teal); outline-offset: -3px; }
.task-row.is-draggable { align-items: flex-start; }

@media (max-width: 680px) {
  .task-kanban { grid-template-columns: repeat(3, minmax(78vw, 1fr)); }
  .task-calendar { grid-template-columns: repeat(7, minmax(76px, 1fr)); }
  .task-calendar-cell { min-height: 82px; padding: 5px; }
  .task-schedule-grid.is-week { min-width: 850px; }
  .task-schedule-grid.is-day { min-width: 0; }
  .task-schedule-toolbar > *,
  .planner-toolbar > * { max-width: 100%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Cloud Sync Config Box */
.sync-config-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
