/* ============================================================
   Social Autopilot 管理画面 — デザインシステム
   白背景 / 墨色 #1a1d24 / グレー #6b7280 / 罫線 #d8dbe2
   フォント: Noto Sans JP（システムフォールバック）
   60代でも読めるサイズ設計・細罫線ミニマル
   ============================================================ */
:root {
  --bg:       #ffffff;
  --bg-2:     #f7f8fa;
  --surface:  #f7f8fa;
  --surface-2:#f0f2f5;
  --ink:      #1a1d24;
  --ink-2:    #374151;
  --mut:      #6b7280;
  --border:   #d8dbe2;
  --border-2: #e9ebef;
  --accent:   #2563eb;
  --accent-2: #1d4ed8;
  --danger:   #dc2626;
  --ok:       #16a34a;
  --warn:     #d97706;
  --r:        8px;
  --r-lg:     12px;
  --font:     "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic UI","Meiryo",sans-serif;
  --sb-w:     240px;
  --shadow:   0 1px 4px rgba(0,0,0,.07);
  --shadow-lg:0 4px 20px rgba(0,0,0,.11);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  min-height: 100vh;
}

/* Mobile top bar */
.mobilebar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  grid-column: 1 / -1;
}
.mobilebar-title { font-size: 15px; font-weight: 700; color: var(--ink); flex: 1; }

/* Sidebar */
.sidebar {
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow-y: auto;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--ink);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 20px; height: 20px; fill: none; }
.brand-texts { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.brand-sub  { font-size: 11px; color: var(--mut); }

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mut);
  padding: 14px 12px 4px;
}
.navbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: var(--r);
  background: transparent;
  color: var(--mut);
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
}
.navbtn:hover  { background: var(--surface);   color: var(--ink-2); }
.navbtn.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.navbtn.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-ic { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.navbtn.active .nav-ic { color: var(--accent); }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.username { font-size: 13px; color: var(--mut); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hamburger */
.hamburger {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-2);
  flex-shrink: 0;
}

/* Mobile scrim */
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 25;
}
.scrim.visible { display: block; }

/* ─── Main content ────────────────────────────────────────── */
#app { padding: 28px 32px 60px; min-width: 0; }
.view { animation: rise .22s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-header { margin-bottom: 24px; }
.page-title  { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.page-desc   { font-size: 14px; color: var(--mut); }

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Buttons ─────────────────────────────────────────────── */
button { font-family: var(--font); cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  border: 1px solid transparent;
  transition: background .13s, border-color .13s, transform .09s;
  line-height: 1;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }

.btn-ghost    { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-2); color: var(--ink); }

.btn-ok       { background: var(--ok);    color: #fff; border-color: var(--ok); }
.btn-ok:hover:not(:disabled) { filter: brightness(1.07); }

.btn-danger   { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }

.btn-note {
  background: #41c9b4;
  color: #fff;
  border-color: #41c9b4;
}
.btn-note:hover:not(:disabled) { filter: brightness(1.08); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Google sign-in button */
.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #fff;
  color: #3c4043;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  transition: box-shadow .15s;
}
.gbtn:hover { box-shadow: 0 3px 10px rgba(0,0,0,.13); }
.gicon { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Login view ──────────────────────────────────────────── */
#loginView {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--surface);
  padding: 20px;
}
.login-card {
  max-width: 400px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 56px;
  height: 56px;
  background: var(--ink);
  border-radius: 14px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo svg { width: 32px; height: 32px; fill: none; }
.login-title { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.login-sub   { font-size: 14px; color: var(--mut); line-height: 1.65; margin-bottom: 28px; }
.login-note  { font-size: 12px; color: var(--mut); margin-top: 16px; }

/* ─── Status messages ─────────────────────────────────────── */
.disconnected {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r);
  padding: 13px 16px;
  font-size: 14px;
  color: #92400e;
  line-height: 1.6;
  margin: 16px 0;
}
.disconnected::before { content: "⚠"; font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.empty-msg   { color: var(--mut); font-size: 14px; padding: 20px 0; }
.loading-msg { color: var(--mut); font-size: 14px; padding: 16px 0; display: flex; align-items: center; gap: 8px; }

/* ─── Stat cards (dashboard) ──────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 20px 16px;
}
.stat-card.stat-warn { border-color: #fde68a; background: #fffbeb; }
.stat-value { font-size: 36px; font-weight: 700; color: var(--ink); line-height: 1; margin-bottom: 6px; }
.stat-card.stat-warn .stat-value { color: var(--warn); }
.stat-label { font-size: 13px; color: var(--mut); }

/* ─── List rows ───────────────────────────────────────────── */
.row-list { display: flex; flex-direction: column; }
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-2);
  font-size: 14px;
}
.row-item:first-child { border-top: 1px solid var(--border-2); }
.row-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.row-date { font-size: 12px; color: var(--mut); white-space: nowrap; }
.row-err  { color: var(--danger); font-size: 13px; flex: 1; }

/* ─── Platform badges ─────────────────────────────────────── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.p-ig   { background: #fce7f3; color: #9d174d; }
.p-fb   { background: #eff6ff; color: #1e40af; }
.p-x    { background: #f3f4f6; color: #111827; }
.p-note { background: #f0fdfa; color: #134e4a; }
.p-zenn { background: #eff6ff; color: #1e3a8a; }
.p-qiita{ background: #f0fdf4; color: #166534; }

/* ─── YMYL gate banner ─────────────────────────────────────── */
.ymyl-gate {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.ymyl-gate-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.ymyl-gate-body {}
.ymyl-gate-body strong { display: block; font-size: 15px; font-weight: 700; color: #78350f; margin-bottom: 2px; }
.ymyl-gate-body p { font-size: 13px; color: #92400e; line-height: 1.6; margin: 0; }

/* YMYL flag chips */
.ymyl-flags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.ymyl-flag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ─── Calendar / themes ───────────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.month-label { font-size: 18px; font-weight: 700; color: var(--ink); min-width: 140px; text-align: center; }

.theme-table { width: 100%; border-collapse: collapse; margin-bottom: 28px; }
.theme-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mut);
  padding: 8px 14px;
  border-bottom: 2px solid var(--border);
}
.theme-table td { padding: 13px 14px; border-bottom: 1px solid var(--border-2); vertical-align: top; font-size: 14px; }
.theme-table td.td-month { color: var(--mut); font-weight: 600; white-space: nowrap; }
.theme-table td.td-theme { color: var(--ink-2); }
.theme-table td.td-note  { color: var(--mut); font-size: 13px; }
.theme-table td.td-acts  { white-space: nowrap; }
.theme-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.ts-pending  { background: var(--surface-2); color: var(--mut); }
.ts-drafted  { background: #eff6ff; color: #1e40af; }
.ts-approved { background: #f0fdf4; color: #166534; }

.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  max-width: 600px;
}
.add-form h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }

/* ─── Forms ──────────────────────────────────────────────── */
.form { max-width: 540px; }
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink-2);
  background: var(--bg);
  transition: border-color .13s;
  line-height: 1.5;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--mut); margin-top: 4px; }

.form-input.masked {
  color: var(--mut);
  letter-spacing: .15em;
  background: var(--surface);
  font-family: monospace;
  font-size: 14px;
}
.form-msg { font-size: 14px; margin-top: 8px; }
.form-msg.ok  { color: var(--ok); }
.form-msg.err { color: var(--danger); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; align-items: center; }

/* API key section */
.apikey-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
  max-width: 540px;
}
.apikey-section h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.apikey-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.apikey-status.set   { color: var(--ok); }
.apikey-status.unset { color: var(--mut); }

/* ─── Review queue cards ──────────────────────────────────── */
.review-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-tab {
  padding: 6px 15px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: transparent;
  color: var(--mut);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: .12s;
}
.filter-tab:hover { border-color: var(--accent); color: var(--accent); }
.filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

.review-cards { display: flex; flex-direction: column; gap: 16px; }
.review-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.review-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-2);
}
.review-card-date { font-size: 12px; color: var(--mut); margin-left: auto; white-space: nowrap; }
.review-card-body { padding: 14px 16px; }
.review-body-text {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.8;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.review-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border-2);
  background: var(--surface);
}
.review-reject-area { padding: 0 16px 14px; }
.review-reject-area textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 14px;
  resize: vertical;
  min-height: 72px;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.review-reject-area textarea:focus { outline: none; border-color: var(--accent); }
.review-done {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 16px;
}
.review-done.approved { color: var(--ok); }
.review-done.rejected { color: var(--danger); }

/* ─── Schedule calendar ───────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.week-label { font-size: 16px; font-weight: 700; color: var(--ink); min-width: 210px; text-align: center; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.week-col {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  min-width: 100px;
}
.week-col.today { border-color: var(--accent); }
.week-head {
  background: var(--surface);
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-2);
}
.week-col.today .week-head { background: #eff6ff; }
.week-day-name { font-size: 11px; font-weight: 700; color: var(--mut); letter-spacing: .06em; }
.week-day-num  { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.week-col.today .week-day-num { color: var(--accent); }
.week-posts { padding: 8px; display: flex; flex-direction: column; gap: 5px; min-height: 56px; }
.sched-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}
.sched-item.st-scheduled { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.sched-item.st-published  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.sched-item.st-failed     { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.sched-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.st-scheduled .sched-dot { background: var(--accent); }
.st-published  .sched-dot { background: var(--ok); }
.st-failed     .sched-dot { background: var(--danger); }

/* ─── Accounts ─────────────────────────────────────────────── */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.account-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.account-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-2);
}
.platform-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.platform-name { font-size: 15px; font-weight: 700; color: var(--ink); flex: 1; }
.acct-status {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 4px;
}
.acct-status.connected    { background: #f0fdf4; color: #166534; }
.acct-status.disconnected { background: var(--surface-2); color: var(--mut); }
.acct-status.semi-auto    { background: #fffbeb; color: #92400e; }

.sameAs-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.sameAs-box h3 { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.sameAs-json {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 10px 14px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: var(--ink-2);
  white-space: pre;
  overflow-x: auto;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 10px;
  line-height: 1.6;
}

/* ─── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--bg);
  border-radius: var(--r-lg);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-card h3 { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* ─── Toast ───────────────────────────────────────────────── */
#toastEl {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--r);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  max-width: 320px;
  animation: slideUp .18s ease;
  line-height: 1.5;
}
#toastEl.t-ok  { background: var(--ok); }
#toastEl.t-err { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 680px) {
  .layout { grid-template-columns: 1fr; }
  .mobilebar { display: flex; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100%;
    width: 240px;
    transition: left .2s ease;
    box-shadow: var(--shadow-lg);
    z-index: 30;
  }
  .sidebar.open { left: 0; }
  #app { padding: 20px 16px 60px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .week-grid { grid-template-columns: 1fr; }
  .accounts-grid { grid-template-columns: 1fr; }
  .theme-table td.td-note { display: none; }
  .page-title { font-size: 19px; }
  .review-card-actions { gap: 8px; }
  .modal-card { padding: 20px; }
}
