:root {
  --bg: #0d0f13;
  --surface: #15181f;
  --surface-hover: #1c2029;
  --surface-2: #1a1e26;
  --border: #262b34;
  --border-strong: #333a46;
  --fg: #eef0f3;
  --muted: #8d95a3;
  --muted-2: #5f6675;
  --accent: #f2a93b;
  --accent-strong: #ffc670;
  --accent-fg: #1a1206;
  --radius-lg: 0;
  --radius: 0;
  --radius-sm: 0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 16px 40px -20px rgba(0, 0, 0, 0.65);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

html,
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

body.app {
  overflow: hidden;
}

#root {
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- form controls ---------- */

input,
select {
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  outline: none;
}

input::placeholder {
  color: var(--muted-2);
}

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

input:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- shell ---------- */

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

.chrome {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.chrome-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  max-width: 72rem;
  margin: 0 auto;
  width: 100%;
}

.brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-left: 0.5rem;
}

.chrome-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 12.5px;
  color: var(--muted);
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.scroll-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--fg);
  background: var(--surface-hover);
}

.tab.active {
  background: var(--accent);
  color: var(--accent-fg);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--fg);
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--muted-2);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-block {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 13.5px;
}

.btn-ghost {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-sm);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--fg);
  background: var(--surface-hover);
}

/* ---------- panels / bordered ---------- */

.bordered {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-title {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

/* ---------- field row (bordered input + button) ---------- */

.field-row {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.field-row input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.6rem 0.8rem;
  font-size: 13.5px;
  min-width: 0;
}

.field-row .btn {
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
}

/* ---------- dense list rows ---------- */

.list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
}

.row + .row {
  border-top: 1px solid var(--border);
}

.row:hover {
  background: var(--surface-hover);
}

.row-main {
  min-width: 0;
  flex: 1;
}

.row-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 13.5px;
}

.row-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 0.2rem;
}

.row-action {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  border-radius: 0;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-solid {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  font-weight: 700;
}

.badge-dashed {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-strong);
}

/* ---------- stat tiles ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-tile {
  padding: 0.9rem 1rem;
  background: var(--surface);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat-label {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* ---------- login ---------- */

.login-shell {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 23rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.login-logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 1.1rem;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.login-title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}

.login-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0 0 1.75rem;
}

.google-btn-slot {
  display: flex;
  justify-content: center;
  margin: 0 auto;
}

.login-error {
  margin-top: 1.25rem;
  font-size: 12px;
  color: #ffb4b4;
  background: rgba(239, 106, 106, 0.1);
  border: 1px solid rgba(239, 106, 106, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  text-align: left;
}

/* ---------- month nav ---------- */

.month-nav {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 1rem;
}

.month-nav .btn {
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.month-nav .btn:hover:not(:disabled) {
  background: var(--surface-hover);
}

.month-nav-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

/* ---------- bar chart ---------- */

.bar-chart-wrap {
  display: flex;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem 0.75rem;
}

.bar-chart-yaxis {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  height: 140px;
  padding-right: 0.6rem;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-family: var(--font-mono);
  line-height: 1;
}

.bar-chart-body {
  flex: 1;
  min-width: 0;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  background-image: repeating-linear-gradient(
    to top,
    var(--border) 0,
    var(--border) 1px,
    transparent 1px,
    transparent 25%
  );
}

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

.bar {
  background: var(--accent);
  border-radius: 0;
  min-height: 2px;
  opacity: 0.85;
  transition: opacity 0.12s ease;
}

.bar-col:hover .bar {
  opacity: 1;
}

.bar-chart-labels {
  display: flex;
  gap: 3px;
  margin-top: 0.35rem;
}

.bar-col-label {
  flex: 1;
  min-width: 3px;
  color: var(--muted);
  font-size: 9.5px;
  text-align: center;
  line-height: 1;
  font-family: var(--font-mono);
}

/* ---------- empty / loading ---------- */

.empty-line {
  color: var(--muted);
  padding: 0.85rem;
  font-size: 13px;
}

/* ---------- focus ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0;
}

/* ---------- month calendar ---------- */

.month-calendar-scroll {
  overflow-x: auto;
}

.month-calendar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 30rem;
}

.month-calendar-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.month-calendar-head div {
  padding: 0.5rem;
  text-align: center;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.month-calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
}

.month-calendar-cell {
  min-height: 4.75rem;
  padding: 0.35rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.month-calendar-cell.is-outside {
  background: var(--bg);
}

.month-calendar-cell.is-today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.month-calendar-daynum {
  font-size: 10.5px;
  text-align: right;
  color: var(--muted);
  font-family: var(--font-mono);
}

.month-calendar-cell.is-today .month-calendar-daynum {
  color: var(--accent);
  font-weight: 700;
}

.month-calendar-day-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  border-radius: var(--radius-sm);
}

.month-calendar-day-btn.is-selected {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.calendar-slot {
  display: block;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.3;
  padding: 0.15rem 0.35rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
}

.calendar-slot:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.calendar-slot:disabled {
  cursor: not-allowed;
  color: var(--muted-2);
}

.calendar-slot.is-mine {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  font-weight: 700;
}

.calendar-chip {
  display: block;
  font-size: 9.5px;
  line-height: 1.3;
  padding: 0.15rem 0.35rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
}

.calendar-chip.full {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  border-color: transparent;
}

.calendar-chip.closed {
  opacity: 0.55;
}
