:root {
  --bg: #0b0612;
  --side: #0c0714;
  --card: #161022;
  --card-top: #1e1430;
  --line: rgba(176, 72, 248, 0.14);
  --text: #f6f2fb;
  --muted: #b3a4c4;
  --faint: #7d6d90;
  --purple: #8000f8;
  --purple-light: #b048f8;
  --purple-soft: rgba(128, 0, 248, 0.2);
  --green: #3ddc97;
  --red: #ff6b8a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(128, 0, 248, 0.22), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans Myanmar", "Myanmar Text", sans-serif;
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.app {
  display: flex;
  min-height: 100%;
}

.sidebar {
  width: 88px;
  flex: 0 0 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 0 18px;
  background: rgba(12, 7, 18, 0.94);
  border-right: 1px solid var(--line);
}

.sidebar-gap { flex: 1; }

.nav-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #8b759e;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn.logo,
.nav-btn.logo:hover {
  width: 68px;
  height: 40px;
  background: transparent;
  color: white;
}

.nav-btn.logo img {
  width: 68px;
  height: 28px;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}

.nav-btn.is-active,
.nav-btn:hover {
  background: var(--purple);
  color: white;
}

.workspace {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 460px) minmax(140px, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 28px;
  font-weight: 700;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: #140e20;
  border: 1px solid var(--line);
}

.search svg {
  width: 18px;
  height: 18px;
  stroke: var(--faint);
  fill: none;
  stroke-width: 1.8;
}

.search input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
}

.search input::placeholder { color: var(--faint); }

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #1a1228;
  color: #c5c9d8;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.icon-btn i {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple);
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(160deg, #b048f8, #8000f8);
  font-size: 13px;
  font-weight: 700;
}

.role-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat, .panel {
  background: linear-gradient(180deg, var(--card-top), var(--card) 42%);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.stat {
  min-height: 132px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat.ring-stat {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.stat-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
}

.delta { color: var(--green); font-size: 13px; }
.hint { color: var(--faint); font-size: 12px; }

.spark, .bars, .ring { display: block; }
.spark { width: 112px; height: 40px; }
.bars { width: 92px; height: 40px; }
.ring { width: 74px; height: 74px; }

.panel { margin-top: 16px; padding: 20px 22px 18px; }
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav strong { min-width: 140px; text-align: center; font-size: 16px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.hour-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}
.hour-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #120c1c;
}
.hour-card strong { grid-column: 1 / -1; font-size: 14px; }
.hour-span { grid-column: 1 / -1; }
.hour-note { grid-column: 1 / -1; margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.hour-card label { display: grid; gap: 6px; }
.hour-card span { color: var(--muted); font-size: 12px; }
.hour-card input,
.hour-card select {
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0612;
  color: var(--text);
}
.hour-grid .btn { height: 42px; }
.cal-week { margin: 16px 0 8px; color: var(--faint); font-size: 12px; text-align: center; }
.cal-day {
  min-height: 112px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #120c1c;
}
.cal-day.is-empty { border-color: transparent; background: transparent; }
.cal-day.is-today { border-color: var(--purple-light); }
.cal-day strong { display: block; margin-bottom: 8px; font-size: 14px; }
.slot { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.slot input { width: 15px; height: 15px; margin: 0; accent-color: var(--purple); }
.day-result-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.day-result {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0612;
  color: var(--text);
  font-size: 12px;
  text-align: center;
}
.day-save {
  flex: none;
  height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 8px;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.day-save:disabled { opacity: 0.6; }
.round-result { display: grid; gap: 6px; max-width: 240px; margin-top: 14px; }
.round-result span { color: var(--muted); font-size: 13px; }
.round-result-row { display: flex; align-items: center; gap: 8px; }
.round-result input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0612;
  color: var(--text);
  text-align: center;
}
.round-result .day-save { height: 46px; padding: 0 14px; font-size: 13px; }
.slot-short { display: none; }
.rounds { display: grid; gap: 14px; margin-top: 16px; }
.round-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #120c1c;
}
.round-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.round-head strong { font-size: 16px; }
.round-head span, .round-card p { color: var(--muted); font-size: 13px; }
.round-card p { margin: 6px 0 0; }
.round-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.range-pair { display: grid; grid-template-columns: 1fr 150px; gap: 10px; align-items: end; }
.round-range label { display: grid; gap: 6px; }
.round-range span { color: var(--muted); font-size: 13px; }
.round-range select,
.round-range input {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0612;
  color: var(--text);
  color-scheme: dark;
}
@media (max-width: 900px) {
  .cal-week, .cal-grid { gap: 6px; }
  .slot { font-size: 11px; }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-head h2 { font-size: 18px; }
.panel-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }

.year-select, .field input, .field select {
  background: #120c1c;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

.year-select {
  height: 36px;
  padding: 0 12px;
  color: var(--muted);
}

.chart-svg { width: 100%; height: 280px; display: block; margin-top: 8px; }
.months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.view.is-hidden { display: none; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: #241834;
  color: var(--text);
}

.btn.primary { background: var(--purple); }
.btn.primary:hover { background: #9418ff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.warn { background: rgba(255, 107, 138, 0.14); color: #ffb3c2; }
.btn.ok { background: rgba(61, 220, 151, 0.12); color: var(--green); }
.btn:disabled { opacity: 0.55; cursor: default; }

.modal[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 12, 0.72);
  z-index: 20;
}

.modal-card {
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 22px;
  border-radius: 18px;
  background: #1a1228;
  border: 1px solid var(--line);
}
.modal-card.is-wide {
  width: min(1180px, 100%);
  max-height: min(92vh, 860px);
}

.modal-card h2 { font-size: 20px; }
.modal-card .lead { margin: 6px 0 16px; color: var(--muted); font-size: 14px; }

.toast[hidden] { display: none; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #221832;
  border: 1px solid var(--line);
}

.note-panel p { margin-top: 12px; color: var(--muted); line-height: 1.6; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar { grid-template-columns: 1fr; }
  .search { max-width: 460px; }
}

.app[hidden], .main-gate[hidden] { display: none; }
.main-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.main-gate-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #1a1228;
}
.main-gate-card img { width: 120px; height: 48px; object-fit: cover; object-position: center; }
.main-gate-card h1 { font-size: 28px; }
.main-gate-card p { color: var(--muted); }
.main-gate-card label { display: grid; gap: 6px; }
.main-gate-card label span { color: var(--muted); font-size: 13px; }
.main-gate-card input:not([type="checkbox"]) {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #120c1c;
  outline: none;
}
.main-gate-card .remember { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.main-gate-card .remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--purple); }
.main-gate-card .btn { height: 46px; width: 100%; }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    width: 100%;
    height: 64px;
    flex-direction: row;
    flex-basis: auto;
    justify-content: space-around;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .sidebar-gap, .nav-btn.logo { display: none; }
  .workspace { padding: 16px 14px 96px; }
  h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .panel-head { flex-direction: column; }
  .month-nav { width: 100%; justify-content: space-between; }
  .month-nav strong { min-width: 0; }
  .cal-day { min-height: 0; min-width: 0; padding: 6px 4px; }
  .cal-day strong { margin-bottom: 4px; font-size: 12px; }
  .slot { justify-content: flex-start; gap: 4px; margin-top: 4px; }
  .slot-long { display: none; }
  .slot-short { display: inline; }
  .round-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .round-range, .range-pair { grid-template-columns: 1fr; }
  .hour-grid { grid-template-columns: 1fr; }
  .hour-grid .btn { width: 100%; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal-card, .modal-card.is-wide { width: 100%; max-height: 92vh; }
  .top-actions { justify-content: flex-start; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .app { flex-direction: row; }
  .sidebar {
    position: static;
    width: 68px;
    height: auto;
    flex: 0 0 68px;
    flex-direction: column;
    justify-content: flex-start;
    padding: 10px 0;
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .sidebar-gap { display: block; }
  .nav-btn.logo { display: grid; width: 52px; height: 32px; }
  .nav-btn.logo img { width: 52px; height: 22px; }
  .workspace { padding: 12px 14px 16px; }
  .main-gate { padding: 12px; }
  .main-gate-card { padding: 16px; }
  .cal-day { min-height: 72px; }
  .chart-svg { height: 180px; }
}

.pass-field {
  position: relative;
  display: block;
  width: 100%;
}
.pass-field input {
  width: 100%;
  padding-right: 44px;
  box-sizing: border-box;
}
.pass-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pass-toggle:hover { color: var(--text); }
.pass-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
