:root {
  color-scheme: light;
  --bg: #f7f0e6;
  --screen: #fffaf3;
  --card: #ffffff;
  --ink: #181716;
  --muted: #777069;
  --line: #eadfce;
  --gold: #c9a961;
  --gold-dark: #8b6b2d;
  --green: #2f855a;
  --pink: #db2777;
  --blue: #2563eb;
  --soft-gold: #fff4cf;
  --soft-green: #e7f6ee;
  --soft-pink: #ffe8f3;
  --soft-blue: #e9f1ff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(circle at top, #fff8e7 0, var(--bg) 45%, #e7dccd 100%);
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px 22px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 13px; font-weight: 800; }
h1 { margin: 0; font-size: 30px; line-height: 1.05; letter-spacing: -0.055em; }
h2 { margin: 0; letter-spacing: -0.045em; }
h3 { margin: 0 0 10px; font-size: 15px; }
.logout { color: #5a5148; font-size: 13px; text-decoration: none; padding-top: 7px; }
.hidden { display: none !important; }

.direction-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 20px;
  color: white;
  background: linear-gradient(135deg, #15120d 0%, #3d2f14 58%, #8b6b2d 100%);
  box-shadow: 0 18px 44px rgba(61, 47, 20, .20);
}
.direction-card::after {
  content: "";
  position: absolute;
  right: -42px;
  top: -52px;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.direction-card .eyebrow { color: #d9cda9; }
.direction-card h2 { max-width: 310px; font-size: 24px; line-height: 1.22; }
.direction-card p:last-child { max-width: 310px; margin: 10px 0 0; color: #eee6d8; font-size: 13px; line-height: 1.5; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 2px 11px; }
.section-head h2 { font-size: 20px; }
.section-head span { color: var(--muted); font-size: 12px; font-weight: 800; }
.hermes-select-btn { min-height: 34px; border: 0; border-radius: 999px; padding: 0 12px; background: #111827; color: white; font-size: 12px; font-weight: 900; box-shadow: 0 8px 18px rgba(17,24,39,.14); }
.hermes-select-btn:disabled { opacity: .62; }
.section-head.compact { margin-top: 0; }
.helper { margin: -3px 2px 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.assistant-list, .inbox-list, .business-grid, .review-grid, .mini-list, .memo-list { display: grid; gap: 12px; }
.task-card, .inbox-card, .business-card, .review-card, .skip-card, .assistant-result, .quick-form, .empty-state, .mini-task, .note-card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 8px 22px rgba(93, 72, 42, .06);
}
.task-card { padding: 16px; }
.task-card.reminder-due, .mini-task.reminder-due, .business-task.reminder-due { border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, .10), 0 8px 22px rgba(93, 72, 42, .06); }
.task-top { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.rank {
  width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  background: #111827; color: white; font-size: 14px; font-weight: 900;
}
.rank.esnah { background: var(--gold-dark); }
.rank.villa { background: var(--green); }
.rank.karaoke { background: var(--pink); }
.rank.company { background: var(--blue); }
.rank.parenting { background: #7c3aed; }
.rank.study { background: #0f766e; }
.rank.other { background: #64748b; }
.task-title { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 900; letter-spacing: -0.035em; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pill { font-size: 11px; font-weight: 850; padding: 5px 8px; border-radius: 999px; color: #3d2f14; background: var(--soft-gold); }
.pill.villa { color: #14532d; background: var(--soft-green); }
.pill.karaoke { color: #9d174d; background: var(--soft-pink); }
.pill.company, .pill.time { color: #1d4ed8; background: var(--soft-blue); }
.pill.personal { color: #5b21b6; background: #f1e9ff; }
.pill.parenting { color: #6d28d9; background: #f3e8ff; }
.pill.study { color: #0f766e; background: #ccfbf1; }
.pill.other { color: #475569; background: #f1f5f9; }
.pill.approval { color: #9f1239; background: #ffe4e6; }
.pill.source { color: #4b5563; background: #f3f4f6; }
.pill.confidence { color: #7c2d12; background: #ffedd5; }
.pill.reminder { color: #991b1b; background: #fee2e2; }
.reason { margin: 12px 0 0 48px; color: var(--muted); font-size: 13px; line-height: 1.48; }
.reason-block { display: grid; gap: 8px; margin: 12px 0 0 48px; }
.reason-block div { border-radius: 16px; background: #fff8ec; padding: 10px 12px; }
.reason-block span { display: block; margin-bottom: 3px; color: #8b6b2d; font-size: 11px; font-weight: 950; }
.reason-block p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.48; }
.empty-state { padding: 17px; }
.empty-state strong { display: block; margin-bottom: 7px; font-size: 15px; line-height: 1.35; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.muted-small { margin-top: 10px !important; font-size: 12px !important; }
.fallback-notice { padding: 10px 12px; border-radius: 16px; background: #fff8ec; color: #7c2d12; font-size: 12px; font-weight: 850; }
.task-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 13px 0 0 48px; }
.action-btn { border: 0; border-radius: 14px; min-height: 40px; background: #f3eadc; color: #3d2f14; font-size: 12px; font-weight: 900; }
.action-btn.primary { background: #111827; color: white; }
.action-btn.done { background: #e7f6ee; color: #14532d; }
.action-btn.danger { background: #fff1f2; color: #9f1239; }
.action-btn:disabled { opacity: .55; }

.skip-card, .assistant-result { padding: 15px 16px; margin-top: 14px; }
.skip-card { background: #f3eadc; color: #5a5148; }
.skip-card strong { color: #3d2f14; }
.skip-card ul, .review-card ul { margin: 9px 0 0; padding-left: 19px; }
.skip-card li, .review-card li { margin: 6px 0; }
.assistant-result p { margin: 0; color: #3d2f14; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.ghost { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }

.quick-form { display: grid; gap: 9px; margin-top: 14px; padding: 10px; }
.quick-row { display: grid; grid-template-columns: 1fr 70px; gap: 9px; }
.quick-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.mode-chip { min-height: 36px; border: 0; border-radius: 14px; background: #f3eadc; color: #5a5148; font-size: 12px; font-weight: 900; }
.mode-chip.active { background: #111827; color: white; }
.category-strip { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.category-chip { flex: 0 0 auto; min-height: 34px; border: 0; border-radius: 999px; padding: 0 11px; background: #f3eadc; color: #5a5148; font-size: 12px; font-weight: 950; }
.category-chip.active.esnah, .category-chip.esnah:focus { background: var(--soft-gold); color: var(--gold-dark); }
.category-chip.active.villa, .category-chip.villa:focus { background: var(--soft-green); color: #14532d; }
.category-chip.active.karaoke, .category-chip.karaoke:focus { background: var(--soft-pink); color: #9d174d; }
.category-chip.active.company, .category-chip.company:focus { background: var(--soft-blue); color: #1d4ed8; }
.category-chip.active.personal, .category-chip.personal:focus { background: #f1e9ff; color: #5b21b6; }
.category-chip.active.other, .category-chip.other:focus { background: #f1f5f9; color: #475569; }
.quick-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: center; }
.quick-options label { display: flex; align-items: center; gap: 6px; min-height: 38px; border-radius: 14px; background: #fffdf8; border: 1px solid #f0e5d4; padding: 0 10px; color: var(--muted); font-size: 12px; font-weight: 850; }
.quick-options input[type="date"], .quick-options input[type="datetime-local"], .quick-options select { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); }
.quick-options .approval-option { grid-column: 1 / -1; }
.quick-form input { min-width: 0; min-height: 48px; border: 1px dashed #d7c6aa; border-radius: 17px; padding: 0 14px; background: #fffdf8; color: var(--ink); }
.reminder-time-select { max-height: 220px; }
.reminder-sheet { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; padding: 16px; }
.reminder-sheet-backdrop { position: absolute; inset: 0; background: rgba(24, 23, 22, .34); backdrop-filter: blur(4px); }
.reminder-sheet-card { position: relative; width: min(100%, 430px); border: 1px solid var(--line); border-radius: 28px 28px 22px 22px; background: var(--screen); padding: 18px; box-shadow: 0 -18px 44px rgba(61,47,20,.22); }
.reminder-picker-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.reminder-picker-row label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 900; }
.reminder-picker-row input, .reminder-picker-row select { min-height: 46px; border: 1px solid #eadfce; border-radius: 16px; background: #fffdf8; padding: 0 12px; color: var(--ink); font-weight: 850; }
.reminder-sheet-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.quick-form .quick-row > button { border: 0; border-radius: 17px; background: #111827; color: white; font-weight: 900; }

.mini-task { padding: 14px; display: grid; gap: 12px; }
.mini-task.completed { opacity: .72; }
.mini-task.completed strong { text-decoration: line-through; color: var(--muted); }
.mini-task strong { display: block; font-size: 15px; line-height: 1.35; letter-spacing: -0.02em; }
.mini-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.mini-actions .action-btn { min-height: 36px; font-size: 11px; }

.inbox-card, .business-card, .review-card, .note-card { padding: 15px; }
.inbox-card p, .business-card p, .review-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.inbox-card strong, .business-card strong, .note-card strong { display: block; margin-bottom: 6px; font-size: 15px; line-height: 1.35; }
.inbox-meta, .business-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.inbox-controls { display: grid; gap: 9px; margin-top: 12px; }
.inbox-controls select { min-height: 40px; border: 1px solid #eadfce; border-radius: 14px; background: #fffdf8; padding: 0 10px; color: var(--ink); font-weight: 850; }
.inbox-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.inbox-actions .action-btn { min-height: 36px; font-size: 11px; }
.note-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-top: 10px; }
.note-actions .action-btn { min-height: 36px; font-size: 11px; }
.note-card strong { word-break: break-word; }
.note-card.esnah, .task-card.esnah { border-color: rgba(139,107,45,.35); }
.note-card.villa, .task-card.villa { border-color: rgba(47,133,90,.35); }
.note-card.karaoke, .task-card.karaoke { border-color: rgba(219,39,119,.35); }
.note-card.company, .task-card.company { border-color: rgba(37,99,235,.28); }
.note-card.personal, .task-card.personal { border-color: rgba(91,33,182,.24); }
.note-card.other, .task-card.other { border-color: rgba(100,116,139,.25); }
.business-card.esnah { border-color: rgba(139,107,45,.35); }
.business-card.villa { border-color: rgba(47,133,90,.35); }
.business-card.karaoke { border-color: rgba(219,39,119,.35); }
.business-card.company { border-color: rgba(37,99,235,.28); }
.business-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { border: 0; border-radius: 15px; background: #fff8ec; padding: 9px; text-align: center; }
.stat.active { background: #111827; color: white; box-shadow: 0 8px 18px rgba(17,24,39,.14); }
.stat.active span { color: #f7f0e6; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 11px; font-weight: 800; }
.business-task-list { display: grid; gap: 8px; margin-top: 12px; }
.business-task { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 16px; background: #fffdf8; border: 1px solid #f0e5d4; }
.business-task.completed { opacity: .72; }
.business-task strong { margin: 0; font-size: 13px; }
.business-task span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 800; }
.business-task-actions { display: grid; grid-template-columns: repeat(2, 52px); gap: 6px; }
.business-task-actions .action-btn { min-height: 34px; font-size: 11px; }
.business-empty { margin: 12px 0 0; padding: 12px; border-radius: 16px; background: #fffdf8; color: var(--muted); text-align: center; font-size: 12px; }
.review-folders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.review-folder-btn { min-height: 42px; border: 0; border-radius: 16px; background: #f3eadc; color: #5a5148; font-size: 12px; font-weight: 900; }
.review-folder-btn.active { background: #111827; color: white; }
.activity-summary-card, .activity-log-card { margin-bottom: 12px; }
.activity-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.activity-stat { border-radius: 14px; background: #fff8ec; padding: 9px 6px; text-align: center; }
.activity-stat b { display: block; font-size: 17px; }
.activity-stat span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 900; }
.activity-log-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.activity-log-list li { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; }
.activity-log-list span { border-radius: 999px; background: #f3eadc; padding: 5px 7px; color: #5a5148; text-align: center; font-size: 10px; font-weight: 900; }
.activity-log-list strong { min-width: 0; font-size: 13px; line-height: 1.35; }
.review-card.accent { background: #20170d; color: white; }
.review-card.accent p { color: #eee6d8; }

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,250,243,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tab { border: 0; border-radius: 16px; background: transparent; color: #9b9287; min-height: 56px; font-size: 11px; font-weight: 850; }
.tab span { display: block; font-size: 18px; margin-bottom: 2px; }
.tab.active { background: #f3eadc; color: #111827; }
.empty { margin: 0; padding: 17px; border: 1px dashed #d7c6aa; border-radius: 20px; color: var(--muted); text-align: center; font-size: 13px; }
.error { margin: 12px auto; width: min(100% - 28px, 430px); border-radius: 18px; background: #fff1f2; color: #9f1239; padding: 12px; }

.login-page { display: grid; min-height: 100svh; place-items: center; padding: 20px; }
.login-card { width: min(100%, 360px); border: 1px solid var(--line); border-radius: 24px; background: var(--screen); padding: 22px; box-shadow: 0 18px 44px rgba(61,47,20,.15); }
.login-card h1 { margin-bottom: 16px; }
.login-card form { display: grid; gap: 10px; }
.login-card input, .login-card button { min-height: 48px; border-radius: 16px; border: 1px solid #d7c6aa; padding: 0 13px; }
.login-card button { border: 0; background: #111827; color: white; font-weight: 900; }
.muted { color: var(--muted); font-size: 13px; }

@media (max-width: 380px) {
  .task-actions, .mini-actions, .inbox-actions { grid-template-columns: repeat(2, 1fr); }
  .reason, .reason-block, .task-actions { margin-left: 0; }
  .quick-options { grid-template-columns: 1fr; }
  .business-stats { grid-template-columns: 1fr; }
}
