
:root {
  --canvas: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --success: #059669;
  --warning: #d97706;
  --danger: #e11d48;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --shadow-card: 0 12px 34px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(79,70,229,.25); outline-offset: 2px; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.skip-link { position:fixed;left:12px;top:-100px;z-index:1000;background:#111827;color:#fff;padding:10px 14px;border-radius:10px;text-decoration:none; }
.skip-link:focus { top:12px; }

.app-shell { min-height: 100vh; }
.main-content { min-width: 0; padding: 72px 0 calc(96px + env(safe-area-inset-bottom)); }
.page-container { width: min(100% - 32px, 1240px); margin-inline: auto; }
.page-intro { margin-bottom: 28px; max-width: 75ch; }
.page-title { margin-top: 6px; font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.2; font-weight: 800; letter-spacing: -.035em; }
.page-description { margin-top: 10px; max-width: 66ch; color: var(--muted); font-size: .95rem; line-height: 1.65; }
.eyebrow { color: var(--accent); font-size: .72rem; line-height: 1.4; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.section-block { margin-top: 32px; margin-bottom: 24px; }
.section-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.section-title { margin-top: 4px; font-size: 1.15rem; line-height: 1.35; font-weight: 800; letter-spacing: -.02em; }

.mobile-header { position:fixed; inset:0 0 auto 0; height:64px; z-index:40; display:flex; align-items:center; justify-content:space-between; padding:0 16px; padding-top: env(safe-area-inset-top); background:rgba(255,255,255,.92); border-bottom:1px solid rgba(226,232,240,.9); backdrop-filter:blur(16px); }
.mobile-header-brand { display:flex; align-items:center; gap:10px; min-width:0; }
.brand-mark { display:grid; place-items:center; width:36px; height:36px; border-radius:12px; color:white; background:linear-gradient(145deg,#6366f1,#4338ca); box-shadow:0 8px 18px rgba(79,70,229,.24); }
.brand-copy strong { display:block; font-size:.9rem; line-height:1.2; }
.brand-copy span { display:block; margin-top:2px; color:var(--muted); font-size:.68rem; }
.icon-button { display:inline-grid; place-items:center; width:44px; height:44px; border:1px solid var(--border); border-radius:14px; background:#fff; color:#334155; }
.icon-button:hover { background:#f8fafc; }

.desktop-sidebar { display:none; }
.bottom-navigation { position:fixed; inset:auto 0 0; z-index:45; display:grid; grid-template-columns:repeat(5,1fr); gap:2px; min-height:72px; padding:8px 8px calc(8px + env(safe-area-inset-bottom)); background:rgba(255,255,255,.95); border-top:1px solid var(--border); backdrop-filter:blur(18px); }
.bottom-link { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:52px; border-radius:14px; color:#64748b; font-size:.64rem; font-weight:700; text-decoration:none; }
.bottom-link.active { color:var(--accent); background:#eef2ff; }
.bottom-link.action { margin-top:-24px; color:#fff; background:linear-gradient(145deg,#6366f1,#4338ca); border:5px solid #f8fafc; border-radius:20px; box-shadow:0 12px 28px rgba(79,70,229,.28); }
.bottom-link.action.active { color:#fff; }

.hero-card { position:relative; min-height:300px; padding:28px; border-radius:var(--radius-xl); background:linear-gradient(135deg,#312e81 0%,#4f46e5 55%,#7c3aed 100%); box-shadow:0 24px 60px rgba(79,70,229,.22); }
.hero-orb { position:absolute; border-radius:999px; background:rgba(255,255,255,.09); filter:blur(.2px); }
.hero-orb-one { width:220px;height:220px;right:-60px;top:-70px; }
.hero-orb-two { width:160px;height:160px;right:90px;bottom:-90px; }

.surface-card, .metric-card { background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow-card); }
.surface-card { padding:20px; border-radius:var(--radius-lg); }
.metric-card { position:relative; min-height:178px; padding:20px; border-radius:20px; overflow:hidden; }
.metric-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:14px; }
.metric-label { margin-top:20px; color:var(--muted); font-size:.78rem; font-weight:700; }
.metric-value { margin-top:4px; font-size:1.9rem; line-height:1.15; font-weight:800; letter-spacing:-.04em; }
.metric-caption { margin-top:6px; color:#94a3b8; font-size:.72rem; line-height:1.45; }

.btn { min-height:44px; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 15px; border:1px solid transparent; border-radius:14px; font-size:.82rem; line-height:1.2; font-weight:800; text-decoration:none; transition:transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.btn:hover { transform:translateY(-1px); }
.btn:active { transform:translateY(0); }
.btn:disabled { cursor:not-allowed; opacity:.5; transform:none; }
.btn-primary { background:var(--accent); color:white; box-shadow:0 10px 20px rgba(79,70,229,.18); }
.btn-primary:hover { background:var(--accent-dark); }
.btn-secondary { color:#334155; background:white; border-color:#cbd5e1; }
.btn-secondary:hover { background:#f8fafc; border-color:#94a3b8; }
.btn-tertiary { min-height:38px; padding:8px 10px; color:var(--accent); background:transparent; }
.btn-tertiary:hover { background:#eef2ff; }
.btn-danger { color:white; background:#e11d48; }
.btn-danger:hover { background:#be123c; }
.btn-on-dark { color:#312e81; background:#fff; box-shadow:0 12px 30px rgba(15,23,42,.18); }
.btn-ghost-on-dark { color:white; border-color:rgba(255,255,255,.28); background:rgba(255,255,255,.10); }

.badge { display:inline-flex; align-items:center; gap:6px; min-height:26px; padding:5px 9px; border-radius:999px; font-size:.68rem; font-weight:800; white-space:nowrap; }
.badge-neutral { color:#475569; background:#f1f5f9; }
.badge-success { color:#047857; background:#ecfdf5; }
.badge-warning { color:#b45309; background:#fffbeb; }
.badge-danger { color:#be123c; background:#fff1f2; }

.progress-item { padding:16px; border:1px solid #e2e8f0; border-radius:18px; background:#fff; }
.progress-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.progress-meta { display:flex; align-items:center; gap:12px; min-width:0; }
.progress-icon { display:grid; place-items:center; width:42px; height:42px; flex:0 0 auto; border-radius:14px; color:#4f46e5; background:#eef2ff; }
.progress-name { font-size:.88rem; font-weight:800; }
.progress-values { margin-top:3px; color:var(--muted); font-size:.72rem; }
.progress-percent { color:#334155; font-size:.82rem; font-weight:800; }
.progress-track { height:8px; margin-top:14px; overflow:hidden; border-radius:999px; background:#e2e8f0; }
.progress-bar { height:100%; border-radius:inherit; background:linear-gradient(90deg,#6366f1,#4f46e5); transition:width .4s ease; }
.progress-bar.complete { background:linear-gradient(90deg,#10b981,#059669); }

.report-preview { margin:0; padding:16px; border:1px solid #d1fae5; border-radius:18px; background:#f0fdf4; color:#14532d; white-space:pre-wrap; overflow-wrap:anywhere; font:500 .74rem/1.65 ui-monospace,SFMono-Regular,Menlo,monospace; }

.form-grid { display:grid; gap:18px; }
.field-group { display:flex; flex-direction:column; gap:7px; }
.field-label { color:#334155; font-size:.78rem; font-weight:800; }
.required { color:#e11d48; }
.field-help { color:#64748b; font-size:.69rem; line-height:1.5; }
.input-wrap { position:relative; display:block; }
.input-icon { position:absolute; left:14px; top:50%; width:18px; height:18px; color:#94a3b8; transform:translateY(-50%); pointer-events:none; }
.form-input, .form-textarea, .form-select { width:100%; min-height:46px; border:1px solid #cbd5e1; border-radius:14px; background:#fff; color:#0f172a; padding:11px 13px; font-size:.85rem; transition:border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.form-input.has-icon { padding-left:43px; }
.form-textarea { resize:vertical; }
.form-input:hover, .form-textarea:hover, .form-select:hover { border-color:#94a3b8; }
.form-input:focus, .form-textarea:focus, .form-select:focus { outline:none; border-color:#6366f1; box-shadow:0 0 0 4px rgba(99,102,241,.12); }
.form-input:disabled { color:#94a3b8; background:#f1f5f9; cursor:not-allowed; }
.form-input[aria-invalid="true"], .form-textarea[aria-invalid="true"] { border-color:#f43f5e; box-shadow:0 0 0 4px rgba(244,63,94,.08); }
.error-panel { padding:13px 14px; border:1px solid #fecdd3; border-radius:14px; color:#9f1239; background:#fff1f2; font-size:.78rem; line-height:1.55; }
.sticky-action-bar { display:flex; flex-direction:column-reverse; gap:10px; margin-top:28px; padding-top:20px; border-top:1px solid var(--border); }

.banner { display:flex; align-items:flex-start; gap:12px; padding:15px 16px; border:1px solid; border-radius:17px; line-height:1.5; }
.banner-info { color:#3730a3; border-color:#c7d2fe; background:#eef2ff; }
.banner-warning { color:#92400e; border-color:#fde68a; background:#fffbeb; }

.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:310px; text-align:center; padding:32px; border:1px dashed #cbd5e1; border-radius:20px; background:#f8fafc; }
.empty-state.compact { min-height:240px; }
.empty-icon { display:grid; place-items:center; width:56px; height:56px; border-radius:18px; color:#4f46e5; background:#eef2ff; }
.empty-state h3 { margin-top:16px; font-size:1rem; font-weight:800; }
.empty-state p { max-width:38ch; margin:7px 0 18px; color:#64748b; font-size:.8rem; line-height:1.6; }

.habit-card { padding:17px; border:1px solid #e2e8f0; border-radius:19px; background:#fff; }
.habit-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.habit-card-main { display:flex; align-items:center; gap:12px; min-width:0; }
.habit-card-icon { display:grid; place-items:center; width:44px; height:44px; flex:0 0 auto; border-radius:14px; color:#4f46e5; background:#eef2ff; }
.habit-card h3 { font-size:.9rem; font-weight:800; }
.habit-card p { margin-top:3px; color:#64748b; font-size:.7rem; }
.habit-actions { display:flex; gap:4px; }
.habit-actions button { display:grid; place-items:center; width:38px; height:38px; border-radius:12px; color:#64748b; }
.habit-actions button:hover { color:#334155; background:#f1f5f9; }
.habit-actions .delete:hover { color:#be123c; background:#fff1f2; }
.habit-stat-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:16px; }
.habit-stat { padding:10px; border-radius:12px; background:#f8fafc; }
.habit-stat span { display:block; color:#64748b; font-size:.62rem; font-weight:700; }
.habit-stat strong { display:block; margin-top:3px; overflow:hidden; text-overflow:ellipsis; font-size:.74rem; white-space:nowrap; }

.modal-backdrop { position:fixed; inset:0; z-index:80; display:grid; place-items:end center; padding:16px; background:rgba(15,23,42,.55); backdrop-filter:blur(5px); }
.modal-card { width:min(100%,600px); max-height:min(90vh,760px); overflow:auto; padding:22px; border-radius:24px; background:#fff; box-shadow:0 30px 80px rgba(15,23,42,.28); animation:modal-in .18s ease-out; }
.modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
.modal-title { font-size:1.15rem; font-weight:800; letter-spacing:-.02em; }
.modal-description { margin-top:5px; color:#64748b; font-size:.76rem; line-height:1.55; }
@keyframes modal-in { from { transform:translateY(20px); opacity:0 } to { transform:none; opacity:1 } }

.toast { position:fixed; left:16px; right:16px; bottom:calc(88px + env(safe-area-inset-bottom)); z-index:100; display:flex; align-items:flex-start; gap:11px; padding:14px 15px; border:1px solid #bbf7d0; border-radius:16px; color:#065f46; background:#ecfdf5; box-shadow:0 18px 50px rgba(15,23,42,.18); animation:toast-in .22s ease-out; }
.toast.error { color:#9f1239; border-color:#fecdd3; background:#fff1f2; }
.toast strong { display:block; font-size:.8rem; }
.toast p { margin-top:3px; font-size:.72rem; line-height:1.45; }
@keyframes toast-in { from { transform:translateY(16px); opacity:0 } to { transform:none; opacity:1 } }

.history-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:13px; border:1px solid #e2e8f0; border-radius:15px; }
.history-row strong { font-size:.78rem; }
.history-row p { margin-top:3px; color:#64748b; font-size:.68rem; }
.history-value { font-size:.72rem; font-weight:800; color:#4f46e5; }

.component-title { font-size:.88rem; font-weight:800; }
.component-note { margin-top:12px; color:#64748b; font-size:.72rem; line-height:1.5; }
.caption-label { color:#64748b; font-size:.68rem; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.color-swatch { display:flex; align-items:center; justify-content:space-between; min-height:54px; padding:12px 14px; border-radius:14px; font-size:.7rem; font-weight:700; }
.color-swatch code { font-size:.64rem; opacity:.75; }
.pattern-card, .device-card { padding:18px; border:1px solid #e2e8f0; border-radius:18px; background:#f8fafc; }
.pattern-icon { display:grid; place-items:center; width:46px; height:46px; border-radius:15px; color:#4f46e5; background:#eef2ff; }
.pattern-card h3, .device-card h3 { margin-top:14px; font-size:.86rem; font-weight:800; }
.pattern-card p, .device-card p { margin-top:6px; color:#64748b; font-size:.72rem; line-height:1.6; }
.device-frame { display:grid; gap:5px; align-content:end; padding:8px; border:2px solid #475569; border-radius:10px; background:#fff; }
.device-frame span { display:block; border-radius:4px; background:#c7d2fe; }
.device-frame span:nth-child(1){height:14px;background:#4f46e5}.device-frame span:nth-child(2){height:25px}.device-frame span:nth-child(3){height:10px}
.mobile-frame { width:58px;height:96px }.tablet-frame { width:92px;height:96px }.desktop-frame { width:145px;height:96px }

@media (min-width: 640px) {
  .page-container { width:min(100% - 48px,1240px); }
  .surface-card { padding:24px; }
  .hero-card { padding:36px; }
  .form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .sticky-action-bar { flex-direction:row; align-items:center; justify-content:space-between; }
  .toast { left:auto; right:24px; width:min(420px,calc(100vw - 48px)); bottom:24px; }
  .modal-backdrop { place-items:center; }
}

@media (min-width: 1024px) {
  .app-shell { display:grid; grid-template-columns:272px minmax(0,1fr); }
  .mobile-header, .bottom-navigation { display:none; }
  .main-content { padding:32px 0 64px; }
  .desktop-sidebar { position:sticky; top:0; display:flex; flex-direction:column; height:100vh; padding:24px 18px; border-right:1px solid var(--border); background:#fff; }
  .desktop-brand { display:flex; align-items:center; gap:12px; padding:0 10px 24px; }
  .desktop-brand .brand-mark { width:44px; height:44px; border-radius:15px; }
  .desktop-brand strong { display:block; font-size:1rem; }
  .desktop-brand span { display:block; margin-top:3px; color:#64748b; font-size:.68rem; }
  .desktop-nav { display:flex; flex-direction:column; gap:5px; }
  .desktop-link { display:flex; align-items:center; gap:12px; min-height:46px; padding:0 13px; border-radius:14px; color:#64748b; font-size:.78rem; font-weight:800; text-decoration:none; }
  .desktop-link:hover { color:#334155; background:#f8fafc; }
  .desktop-link.active { color:#4338ca; background:#eef2ff; }
  .desktop-link.action { margin-top:12px; color:#fff; background:#4f46e5; box-shadow:0 10px 24px rgba(79,70,229,.18); }
  .sidebar-footer { margin-top:auto; padding:16px; border:1px solid #e2e8f0; border-radius:18px; background:#f8fafc; }
  .sidebar-footer p { color:#64748b; font-size:.68rem; line-height:1.55; }
  .sidebar-footer a { display:inline-flex; align-items:center; gap:6px; margin-top:9px; color:#4f46e5; font-size:.7rem; font-weight:800; text-decoration:none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}

/* HabitFlow v2 — mobile-first target architecture */
.mobile-dashboard-container { padding-top: 4px; }
.mobile-hero { position:relative; overflow:hidden; padding:22px; border-radius:26px; color:#fff; background:linear-gradient(145deg,#312e81,#4f46e5 58%,#7c3aed); box-shadow:0 20px 46px rgba(79,70,229,.22); }
.mobile-hero-copy,.mobile-hero-score,.mobile-hero-cta { position:relative; z-index:2; }
.mobile-hero-date { display:inline-flex; font-size:.7rem; line-height:1.4; font-weight:800; color:#c7d2fe; text-transform:capitalize; }
.mobile-hero h1 { margin-top:8px; font-size:1.75rem; line-height:1.18; font-weight:850; letter-spacing:-.04em; }
.mobile-hero p { max-width:42ch; margin-top:8px; color:#e0e7ff; font-size:.78rem; line-height:1.6; }
.mobile-hero-score { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-top:20px; padding:14px 15px; border:1px solid rgba(255,255,255,.18); border-radius:18px; background:rgba(255,255,255,.10); backdrop-filter:blur(8px); }
.mobile-hero-score span { max-width:15ch; color:#e0e7ff; font-size:.7rem; line-height:1.4; font-weight:700; }
.mobile-hero-score strong { font-size:1.8rem; line-height:1; letter-spacing:-.05em; }
.mobile-hero-cta { width:100%; margin-top:14px; }
.mobile-summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; }
.summary-mini-card { display:flex; align-items:center; gap:10px; min-width:0; min-height:76px; padding:12px; border:1px solid var(--border); border-radius:18px; background:#fff; box-shadow:0 8px 24px rgba(15,23,42,.04); }
.summary-mini-icon { display:grid; place-items:center; width:38px; height:38px; flex:0 0 auto; border-radius:13px; }
.summary-mini-card small { display:block; color:#64748b; font-size:.62rem; line-height:1.25; font-weight:700; }
.summary-mini-card strong { display:block; margin-top:2px; font-size:1.05rem; line-height:1.15; font-weight:850; letter-spacing:-.03em; }

.filter-scroll { display:flex; gap:8px; overflow-x:auto; padding:2px 1px 5px; scrollbar-width:none; scroll-snap-type:x proximity; }
.filter-scroll::-webkit-scrollbar { display:none; }
.filter-chip { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:38px; flex:0 0 auto; padding:8px 12px; border:1px solid #dbe2ea; border-radius:999px; color:#64748b; background:#fff; font-size:.7rem; font-weight:800; scroll-snap-align:start; }
.filter-chip.active { color:#4338ca; border-color:#c7d2fe; background:#eef2ff; box-shadow:0 4px 12px rgba(79,70,229,.08); }
.target-card-list { display:grid; gap:12px; }
.target-card { padding:16px; border:1px solid #e2e8f0; border-radius:20px; background:#fff; box-shadow:0 8px 24px rgba(15,23,42,.045); }
.target-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.target-identity { display:flex; align-items:center; gap:11px; min-width:0; }
.target-icon { display:grid; place-items:center; width:42px; height:42px; flex:0 0 auto; border-radius:14px; color:#4f46e5; background:#eef2ff; }
.target-category { display:block; color:#6366f1; font-size:.6rem; line-height:1.2; font-weight:850; letter-spacing:.08em; text-transform:uppercase; }
.target-card h3 { margin-top:3px; overflow:hidden; text-overflow:ellipsis; font-size:.88rem; line-height:1.3; font-weight:850; white-space:nowrap; }
.target-primary-value { display:flex; align-items:baseline; gap:6px; margin-top:17px; min-width:0; }
.target-primary-value span { overflow:hidden; text-overflow:ellipsis; font-size:1.22rem; line-height:1.15; font-weight:850; letter-spacing:-.035em; white-space:nowrap; }
.target-primary-value small { overflow:hidden; color:#64748b; font-size:.66rem; text-overflow:ellipsis; white-space:nowrap; }
.target-meta-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin-top:13px; }
.target-meta-grid > div { min-width:0; padding:9px; border-radius:12px; background:#f8fafc; }
.target-meta-grid span { display:block; color:#94a3b8; font-size:.57rem; line-height:1.2; font-weight:750; }
.target-meta-grid strong { display:block; margin-top:4px; overflow:hidden; color:#334155; font-size:.65rem; line-height:1.25; font-weight:850; text-overflow:ellipsis; white-space:nowrap; }
.target-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; color:#64748b; font-size:.63rem; }
.target-footer strong { color:#4338ca; font-size:.72rem; }
.report-home-card { margin-top:24px; }

.target-action-panel { display:grid; grid-template-columns:1fr; gap:10px; }
.target-list-surface { padding:16px; }
.form-section { display:flex; align-items:flex-start; gap:11px; margin-bottom:14px; }
.form-section-number { display:grid; place-items:center; width:28px; height:28px; flex:0 0 auto; border-radius:9px; color:#fff; background:#4f46e5; font-size:.72rem; font-weight:850; }
.form-section h3 { font-size:.82rem; font-weight:850; }
.form-section p { margin-top:2px; color:#64748b; font-size:.68rem; line-height:1.45; }
.field-link { display:inline-flex; align-items:center; gap:6px; width:max-content; color:#4f46e5; font-size:.68rem; font-weight:800; }
.calculation-preview { display:grid; grid-template-columns:1fr; gap:8px; padding:13px; border:1px solid #c7d2fe; border-radius:16px; background:#eef2ff; }
.calculation-preview > div { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 9px; border-radius:11px; background:rgba(255,255,255,.68); }
.calculation-preview span,.calculation-preview p { color:#6366f1; font-size:.64rem; line-height:1.45; }
.calculation-preview strong { color:#312e81; font-size:.7rem; font-weight:850; text-align:right; }
.modal-wide { width:min(100%,720px); }
.modal-actions { display:flex; flex-direction:column-reverse; gap:10px; margin-top:22px; }
.sticky-modal-actions { position:sticky; bottom:-22px; z-index:2; margin-inline:-22px; padding:14px 22px calc(14px + env(safe-area-inset-bottom)); border-top:1px solid #e2e8f0; background:rgba(255,255,255,.96); backdrop-filter:blur(12px); }
.category-manager-list { display:grid; gap:10px; }
.category-row { display:flex; flex-direction:column; gap:12px; padding:13px; border:1px solid #e2e8f0; border-radius:16px; background:#fff; }
.category-row-main { display:flex; align-items:center; gap:11px; min-width:0; }
.category-row h3 { display:flex; align-items:center; flex-wrap:wrap; gap:4px; font-size:.8rem; font-weight:850; }
.category-row p { margin-top:4px; color:#64748b; font-size:.65rem; }
.category-row-actions { display:flex; align-items:center; justify-content:flex-end; gap:6px; }
.danger-icon { color:#e11d48; }
.danger-icon:disabled { color:#94a3b8; cursor:not-allowed; opacity:.6; }
.add-category-panel { padding:15px; border:1px dashed #cbd5e1; border-radius:18px; background:#f8fafc; }
.add-category-panel h3 { margin-bottom:12px; font-size:.8rem; font-weight:850; }
.unit-list { display:grid; gap:9px; }
.unit-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 13px; border:1px solid #e2e8f0; border-radius:15px; background:#fff; }
.unit-row strong { display:block; font-size:.76rem; }
.unit-row span { display:block; margin-top:3px; color:#64748b; font-size:.64rem; }

.checkin-form-surface { padding:16px; }
.section-divider { height:1px; margin:22px 0; background:#e2e8f0; }
.checkin-list { display:grid; gap:11px; }
.checkin-card { padding:14px; border:1px solid #e2e8f0; border-radius:18px; background:#f8fafc; }
.checkin-head { display:flex; align-items:center; gap:11px; }
.checkin-head label { display:block; margin-top:3px; font-size:.82rem; font-weight:850; }
.checkin-head p { margin-top:4px; color:#64748b; font-size:.65rem; }
.checkin-head p strong { color:#4338ca; }
.input-suffix { position:absolute; right:13px; top:50%; max-width:65px; overflow:hidden; color:#64748b; font-size:.68rem; font-weight:800; text-overflow:ellipsis; transform:translateY(-50%); white-space:nowrap; pointer-events:none; }
.mobile-sticky-actions { position:sticky; bottom:0; z-index:4; margin:24px -16px -16px; padding:13px 16px calc(13px + env(safe-area-inset-bottom)); background:rgba(255,255,255,.96); backdrop-filter:blur(12px); }

.report-layout,.settings-layout { display:grid; gap:24px; }
.quick-range-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.quick-range { min-height:40px; padding:7px; border:1px solid #dbe2ea; border-radius:12px; color:#64748b; background:#fff; font-size:.67rem; font-weight:850; }
.quick-range.active,.quick-range:hover { color:#4338ca; border-color:#c7d2fe; background:#eef2ff; }
.report-metric-list { display:grid; gap:9px; }
.report-metric-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; padding:11px; border:1px solid #e2e8f0; border-radius:15px; }
.report-metric-row strong { display:block; font-size:.74rem; }
.report-metric-row p { margin-top:3px; color:#64748b; font-size:.62rem; }
.report-metric-row b { color:#4338ca; font-size:.72rem; }
.report-editor { min-height:430px; font:500 .76rem/1.7 ui-monospace,SFMono-Regular,Menlo,monospace; }
.report-action-grid { display:grid; gap:10px; margin-top:16px; }
.report-editor-card { align-self:start; }

@media (min-width: 480px) {
  .target-action-panel { grid-template-columns:1fr 1fr; }
  .modal-actions { flex-direction:row; justify-content:flex-end; }
  .calculation-preview { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .calculation-preview > div { display:block; }
  .calculation-preview strong { display:block; margin-top:5px; text-align:left; }
  .category-row { flex-direction:row; align-items:center; justify-content:space-between; }
  .report-action-grid { grid-template-columns:1fr 1fr; }
}

@media (min-width: 640px) {
  .mobile-hero { padding:30px; }
  .mobile-summary-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .target-card-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .checkin-form-surface { padding:24px; }
  .mobile-sticky-actions { position:static; margin:28px 0 0; padding:20px 0 0; background:transparent; backdrop-filter:none; }
}

@media (min-width: 1024px) {
  .mobile-dashboard-container { padding-top:0; }
  .mobile-hero { padding:38px; min-height:315px; display:grid; grid-template-columns:minmax(0,1fr) 260px; align-items:center; gap:24px; }
  .mobile-hero h1 { font-size:2.6rem; }
  .mobile-hero p { font-size:.9rem; }
  .mobile-hero-score { margin:0; align-self:center; }
  .mobile-hero-cta { width:max-content; margin-top:-90px; }
  .target-card-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .report-layout { grid-template-columns:minmax(320px,.72fr) minmax(0,1.28fr); }
  .report-editor-card { position:sticky; top:24px; }
  .settings-layout { grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr); }
}


/* HabitFlow v3 — strict responsive mobile layer */
:root {
  --mobile-header-height: 64px;
  --mobile-nav-height: 78px;
  --viewport-height: 100dvh;
}

html {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
}
body.modal-open { overflow: hidden; }
img, video, canvas, svg { max-width: 100%; }
input, select, textarea, button { min-width: 0; max-width: 100%; }
input[type="date"], input[type="number"], input[type="text"] { appearance: none; -webkit-appearance: none; }
.app-shell, .main-content, .page-container, .surface-card, .target-card,
.report-layout, .settings-layout, .form-grid, .checkin-list, .target-card-list,
.section-heading, .section-heading > *, .target-card-top, .target-identity,
.category-row-main, .report-metric-row > *, .history-row > * { min-width: 0; }

.main-content {
  width: 100%;
  max-width: 100%;
  padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top) + 14px);
  padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 22px);
}
body[data-detail="true"] .main-content {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.page-container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.page-intro { max-width: 100%; margin-bottom: 22px; }
.page-title { overflow-wrap: anywhere; font-size: clamp(1.55rem, 7.3vw, 2.25rem); }
.page-description { max-width: 50ch; overflow-wrap: anywhere; }
.section-block { margin-top: 28px; }
.section-heading { flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; }
.section-heading > :first-child { flex: 1 1 170px; }
.section-heading > .badge, .section-heading > .btn { flex: 0 0 auto; }

.mobile-header {
  width: 100%;
  max-width: 100%;
  height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  gap: 8px;
}
.mobile-header-brand { flex: 1 1 auto; overflow: hidden; }
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-header .icon-button { flex: 0 0 44px; }

.bottom-navigation {
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  padding: 8px max(5px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
  overflow: visible;
}
.bottom-link { min-width: 0; padding-inline: 2px; overflow: hidden; }
.bottom-link span { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.bottom-link.action { width: auto; min-width: 0; margin-inline: 1px; }

.mobile-hero { width: 100%; max-width: 100%; padding: 20px; border-radius: 22px; }
.mobile-hero-copy, .mobile-hero-score { min-width: 0; }
.mobile-hero h1 { overflow-wrap: anywhere; font-size: clamp(1.55rem, 8vw, 2rem); }
.mobile-hero-score { align-items: center; }
.mobile-hero-score strong { flex: 0 0 auto; font-size: clamp(1.55rem, 9vw, 2rem); }
.mobile-hero-cta { white-space: normal; text-align: center; }
.hero-orb-one { right: -105px; }
.hero-orb-two { right: 20px; }

.mobile-summary-grid { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-mini-card { width: 100%; overflow: hidden; padding: 11px; }
.summary-mini-card > div { min-width: 0; }
.summary-mini-card small { overflow-wrap: anywhere; }
.summary-mini-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filter-scroll {
  width: calc(100% + 16px);
  max-width: none;
  margin-right: -16px;
  padding-right: 16px;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}
.filter-chip { max-width: min(78vw, 260px); }
.filter-chip svg { flex: 0 0 auto; }

.surface-card { width: 100%; max-width: 100%; padding: 16px; border-radius: 19px; overflow: hidden; }
.banner { width: 100%; max-width: 100%; padding: 14px; }
.banner > div { min-width: 0; overflow-wrap: anywhere; }
.empty-state { min-height: 250px; padding: 24px 16px; }

.target-card-list { width: 100%; grid-template-columns: minmax(0, 1fr); }
.target-card { width: 100%; max-width: 100%; padding: 15px; overflow: hidden; }
.target-card-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.target-identity > div { min-width: 0; }
.target-card h3 { max-width: 100%; }
.habit-actions { flex: 0 0 auto; }
.target-primary-value { flex-wrap: wrap; align-items: baseline; row-gap: 3px; }
.target-primary-value span, .target-primary-value small { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.target-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.target-meta-grid > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.target-meta-grid strong { white-space: normal; overflow-wrap: anywhere; }
.target-footer { flex-wrap: wrap; align-items: baseline; }

.target-action-panel { width: 100%; }
.target-action-panel .btn { width: 100%; }
.form-grid { width: 100%; grid-template-columns: minmax(0, 1fr); }
.field-group, .input-wrap { min-width: 0; width: 100%; }
.form-input, .form-textarea, .form-select {
  width: 100%; max-width: 100%; font-size: 16px; /* prevents iOS auto zoom */
}
.form-textarea { overflow-wrap: anywhere; }
.input-suffix { max-width: 42%; }
.calculation-preview { width: 100%; }
.calculation-preview > div { min-width: 0; }
.calculation-preview strong { min-width: 0; overflow-wrap: anywhere; }

.checkin-form-surface { padding: 15px; }
.checkin-card { width: 100%; max-width: 100%; padding: 13px; overflow: hidden; }
.checkin-head > div { min-width: 0; }
.checkin-head label, .checkin-head p { overflow-wrap: anywhere; }
.mobile-sticky-actions {
  margin-inline: -15px;
  margin-bottom: -15px;
  padding-inline: 15px;
  bottom: env(safe-area-inset-bottom);
}
.mobile-sticky-actions .btn { width: 100%; }

.quick-range-grid { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quick-range { min-width: 0; white-space: normal; }
.report-layout, .settings-layout { grid-template-columns: minmax(0, 1fr); }
.report-metric-row { width: 100%; grid-template-columns: 42px minmax(0, 1fr) auto; }
.report-metric-row p { overflow-wrap: anywhere; }
.report-metric-row b { white-space: nowrap; }
.report-editor { min-height: min(52dvh, 430px); }
.report-action-grid { grid-template-columns: minmax(0, 1fr); }
.history-row { width: 100%; flex-wrap: wrap; text-align: left; }
.history-row > div { flex: 1 1 160px; }
.history-value { flex: 0 0 auto; }
.report-preview { width: 100%; max-width: 100%; overflow-x: auto; }

.category-row { width: 100%; }
.category-row-main > div { min-width: 0; }
.category-row h3, .category-row p { overflow-wrap: anywhere; }
.category-row-actions { width: 100%; justify-content: stretch; }
.category-row-actions .btn { flex: 1 1 auto; }
.unit-row { width: 100%; }
.unit-row > div { min-width: 0; }
.unit-row strong, .unit-row span { overflow-wrap: anywhere; }

.modal-backdrop {
  width: 100%; height: 100%; min-height: var(--viewport-height);
  padding: max(8px, env(safe-area-inset-top)) 0 0;
  place-items: end stretch;
  overflow: hidden;
}
.modal-card, .modal-wide {
  width: 100%; max-width: 100%;
  max-height: calc(var(--viewport-height) - max(8px, env(safe-area-inset-top)));
  margin: 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-head { gap: 10px; }
.modal-head > div { min-width: 0; }
.modal-title, .modal-description { overflow-wrap: anywhere; }
.modal-head .icon-button { flex: 0 0 44px; }
.sticky-modal-actions {
  bottom: calc(-16px - env(safe-area-inset-bottom));
  margin-inline: -16px;
  padding: 13px 16px calc(13px + env(safe-area-inset-bottom));
}
.modal-actions .btn { width: 100%; }
.toast { max-width: calc(100% - 24px); left: 12px; right: 12px; }

.device-frame { max-width: 100%; }
.desktop-frame { width: min(145px, 100%); }
.color-swatch { gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }

@media (max-width: 359px) {
  .page-container { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .main-content { padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top) + 10px); }
  .mobile-header { padding-inline: max(8px, env(safe-area-inset-left)); }
  .brand-copy span { display: none; }
  .mobile-hero { padding: 17px; }
  .mobile-hero-score { gap: 8px; padding: 12px; }
  .mobile-summary-grid { gap: 8px; }
  .summary-mini-card { gap: 8px; padding: 9px; }
  .summary-mini-icon { width: 34px; height: 34px; }
  .section-heading > :first-child { flex-basis: 145px; }
  .surface-card { padding: 14px; }
  .target-card { padding: 13px; }
  .target-card-top { grid-template-columns: minmax(0, 1fr); }
  .habit-actions { justify-self: end; margin-top: 8px; }
  .target-card-top > .badge { justify-self: start; margin-top: 8px; }
  .target-meta-grid { grid-template-columns: minmax(0, 1fr); }
  .target-meta-grid > div:last-child:nth-child(odd) { grid-column: auto; }
  .quick-range-grid { grid-template-columns: minmax(0, 1fr); }
  .report-metric-row { grid-template-columns: 38px minmax(0, 1fr); }
  .report-metric-row b { grid-column: 2; justify-self: start; }
  .bottom-link { font-size: .58rem; }
  .bottom-link.action { border-width: 4px; }
}

@media (min-width: 480px) {
  .target-action-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .target-meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .target-meta-grid > div:last-child:nth-child(odd) { grid-column: auto; }
  .calculation-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-actions { flex-direction: row; }
  .modal-actions .btn { width: auto; min-width: 120px; }
  .category-row-actions { width: auto; justify-content: flex-end; }
  .category-row-actions .btn { flex: 0 0 auto; }
}

@media (min-width: 640px) {
  .page-container { padding-left: 24px; padding-right: 24px; }
  .surface-card { padding: 24px; border-radius: 22px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .target-card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { padding: 24px; place-items: center; }
  .modal-card, .modal-wide {
    width: min(100%, 720px); max-height: min(88dvh, 780px);
    padding: 24px; border-radius: 26px;
  }
  .sticky-modal-actions { bottom: -24px; margin-inline: -24px; padding-inline: 24px; }
  .toast { left: auto; right: 24px; max-width: min(420px, calc(100% - 48px)); }
}

@media (min-width: 768px) {
  .report-layout, .settings-layout { gap: 28px; }
}

@media (min-width: 1024px) {
  body { overflow-x: hidden; }
  .main-content { padding: 32px 0 64px; }
  body[data-detail="true"] .main-content { padding-bottom: 64px; }
  .page-container { padding-left: 32px; padding-right: 32px; }
  .report-layout { grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); }
  .settings-layout { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); }
  .mobile-hero { border-radius: 28px; }
}

@supports not (height: 100dvh) {
  :root { --viewport-height: 100vh; }
}

/* ========================================================================== 
   HabitFlow V4 — Behavior Design, Performance Psychology & Accountability
   ========================================================================== */

:root {
  --behavior-indigo: #4f46e5;
  --behavior-violet: #7c3aed;
  --behavior-emerald: #059669;
  --behavior-amber: #d97706;
  --behavior-rose: #e11d48;
}

.banner-success { color:#065f46; border-color:#a7f3d0; background:#ecfdf5; }

/* Elegant swipe-to-check-out action */
.swipe-action-wrap { position:relative; z-index:3; margin-top:18px; }
.swipe-action {
  position:relative; display:flex; align-items:center; width:100%; height:60px;
  padding:6px; overflow:hidden; user-select:none; touch-action:none; cursor:grab;
  border:1px solid rgba(255,255,255,.28); border-radius:20px;
  background:rgba(255,255,255,.13); box-shadow:inset 0 1px 0 rgba(255,255,255,.15);
  backdrop-filter:blur(14px);
}
.swipe-action.dragging { cursor:grabbing; }
.swipe-fill { position:absolute; inset:6px auto 6px 6px; width:0; border-radius:15px; background:linear-gradient(90deg,rgba(255,255,255,.98),rgba(238,242,255,.94)); transition:width .18s ease; }
.swipe-action.dragging .swipe-fill { transition:none; }
.swipe-knob {
  position:relative; z-index:2; display:grid; place-items:center; flex:0 0 48px; width:48px; height:48px;
  border-radius:15px; color:#4338ca; background:#fff; box-shadow:0 8px 20px rgba(15,23,42,.22);
  transition:transform .18s ease;
}
.swipe-action.dragging .swipe-knob { transition:none; }
.swipe-label { position:absolute; inset:0; display:grid; place-items:center; padding-inline:68px 56px; color:#fff; font-size:.78rem; font-weight:800; letter-spacing:.01em; pointer-events:none; text-align:center; }
.swipe-chevron { position:absolute; right:17px; color:rgba(255,255,255,.72); font-size:1.25rem; letter-spacing:-3px; animation:swipePulse 1.5s ease-in-out infinite; }
.swipe-action.completed { pointer-events:none; }
.swipe-action.completed .swipe-fill { width:100%!important; }
.swipe-action.completed .swipe-label { color:#3730a3; }
.swipe-action.locked { cursor:not-allowed; border-color:rgba(255,255,255,.16); background:rgba(15,23,42,.20); }
.swipe-action.locked .swipe-knob { color:#64748b; background:#e2e8f0; }
.swipe-action.locked .swipe-chevron { display:none; }
.checkout-window-hint { margin:8px 4px 0; color:rgba(255,255,255,.78); font-size:.68rem; line-height:1.45; text-align:center; }
@keyframes swipePulse { 0%,100%{opacity:.35;transform:translateX(-2px)}50%{opacity:1;transform:translateX(3px)} }

/* Dashboard behavioral feedback */
.dashboard-insight-card {
  display:grid; grid-template-columns:44px minmax(0,1fr) 28px; align-items:center; gap:12px;
  margin-top:16px; padding:15px; border:1px solid #ddd6fe; border-radius:19px;
  color:inherit; background:linear-gradient(135deg,#faf5ff,#eef2ff); box-shadow:var(--shadow-card); text-decoration:none;
}
.insight-icon { display:grid; place-items:center; width:44px; height:44px; border-radius:14px; color:#4f46e5; background:#fff; box-shadow:0 7px 16px rgba(79,70,229,.12); }
.insight-icon.success { color:#059669; }.insight-icon.warning { color:#d97706; }.insight-icon.neutral { color:#4f46e5; }
.dashboard-insight-card div { min-width:0; }
.dashboard-insight-card small { display:block; color:#7c3aed; font-size:.66rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.dashboard-insight-card strong { display:block; margin-top:3px; font-size:.88rem; line-height:1.35; }
.dashboard-insight-card p { margin-top:3px; color:#64748b; font-size:.7rem; line-height:1.5; }
.dashboard-insight-card > svg { color:#6366f1; }
.dashboard-shortcut-grid { display:grid; gap:12px; margin-top:14px; }
.dashboard-shortcut-card {
  display:grid; grid-template-columns:42px minmax(0,1fr) 20px; align-items:center; gap:11px;
  padding:14px; border:1px solid var(--border); border-radius:18px; color:inherit; background:#fff; box-shadow:var(--shadow-card); text-decoration:none;
}
.dashboard-shortcut-card.warning { border-color:#fed7aa; background:#fffaf5; }
.shortcut-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:13px; color:#4f46e5; background:#eef2ff; }
.dashboard-shortcut-card.warning .shortcut-icon { color:#d97706; background:#fffbeb; }
.dashboard-shortcut-card div { min-width:0; }
.dashboard-shortcut-card small { display:block; color:#94a3b8; font-size:.64rem; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.dashboard-shortcut-card strong { display:block; margin-top:2px; font-size:.82rem; }
.dashboard-shortcut-card p { margin-top:2px; color:#64748b; font-size:.68rem; line-height:1.45; }
.dashboard-shortcut-card > svg { color:#94a3b8; }

/* Visual icon picker */
.icon-choice-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; margin-top:9px; }
.icon-choice {
  min-width:0; min-height:76px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px;
  padding:9px 5px; border:1px solid #dbe3ee; border-radius:15px; color:#64748b; background:#fff;
  transition:border-color .15s ease,background .15s ease,color .15s ease,transform .15s ease;
}
.icon-choice:hover { transform:translateY(-1px); border-color:#a5b4fc; }
.icon-choice span { display:grid; place-items:center; width:34px; height:34px; border-radius:11px; background:#f1f5f9; }
.icon-choice small { width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.6rem; font-weight:700; text-align:center; }
.icon-choice.selected { color:#4338ca; border-color:#6366f1; background:#eef2ff; box-shadow:0 0 0 3px rgba(99,102,241,.10); }
.icon-choice.selected span { color:#fff; background:#4f46e5; }

/* Indonesian currency inputs */
.currency-input-wrap { position:relative; }
.currency-prefix { position:absolute; left:14px; top:15px; z-index:2; color:#475569; font-size:.86rem; font-weight:800; pointer-events:none; }
.currency-field { padding-left:42px!important; font-variant-numeric:tabular-nums; letter-spacing:.01em; }
.format-example { display:block; margin-top:7px; color:#64748b; font-size:.67rem; line-height:1.4; }

/* Mandatory penalty in target cards/forms */
.form-section-number.danger { color:#be123c; background:#fff1f2; }
.penalty-form-panel { margin-top:12px; padding:16px; border:1px solid #fecdd3; border-radius:19px; background:linear-gradient(180deg,#fff7f8,#fff); }
.penalty-preview { display:flex; align-items:center; gap:11px; padding:13px; border:1px solid #fed7aa; border-radius:15px; color:#92400e; background:#fffbeb; }
.penalty-preview > span { display:grid; place-items:center; flex:0 0 38px; width:38px; height:38px; border-radius:12px; color:#d97706; background:#fff; }
.penalty-preview div { min-width:0; }
.penalty-preview small,.penalty-preview strong { display:block; overflow-wrap:anywhere; }
.penalty-preview small { font-size:.65rem; }.penalty-preview strong { margin-top:3px; font-size:.78rem; }
.penalty-inline { display:flex; align-items:center; gap:9px; margin-top:13px; padding:10px 11px; border:1px solid #fed7aa; border-radius:13px; background:#fffbeb; }
.penalty-inline-icon { display:grid; place-items:center; flex:0 0 30px; width:30px; height:30px; border-radius:9px; color:#d97706; background:#fff; }
.penalty-inline div { min-width:0; }
.penalty-inline small,.penalty-inline strong { display:block; overflow-wrap:anywhere; }
.penalty-inline small { color:#b45309; font-size:.6rem; }.penalty-inline strong { margin-top:2px; color:#78350f; font-size:.7rem; }

/* Performance psychology */
.psychology-card {
  display:grid; grid-template-columns:52px minmax(0,1fr); gap:15px; padding:20px;
  border:1px solid #c7d2fe; border-radius:24px; background:linear-gradient(135deg,#eef2ff,#faf5ff); box-shadow:0 18px 38px rgba(79,70,229,.09);
}
.psychology-card.success { border-color:#a7f3d0; background:linear-gradient(135deg,#ecfdf5,#f0fdf4); }
.psychology-card.warning { border-color:#fde68a; background:linear-gradient(135deg,#fffbeb,#fff7ed); }
.psychology-icon { display:grid; place-items:center; width:52px; height:52px; border-radius:17px; color:#4f46e5; background:#fff; box-shadow:0 9px 18px rgba(15,23,42,.08); }
.psychology-card.success .psychology-icon { color:#059669; }.psychology-card.warning .psychology-icon { color:#d97706; }
.psychology-card h2 { margin-top:5px; font-size:1.15rem; line-height:1.3; font-weight:850; letter-spacing:-.025em; }
.psychology-card > div > p:not(.eyebrow) { margin-top:8px; color:#475569; font-size:.78rem; line-height:1.65; }
.psychology-action { display:flex; align-items:flex-start; gap:8px; margin-top:12px; padding-top:12px; border-top:1px solid rgba(99,102,241,.16); color:#3730a3; font-size:.72rem; font-weight:750; line-height:1.5; }
.psychology-card.success .psychology-action { color:#047857; border-color:rgba(5,150,105,.16); }.psychology-card.warning .psychology-action { color:#92400e; border-color:rgba(217,119,6,.18); }
.psychology-action svg { flex:0 0 auto; margin-top:2px; }
.performance-stat-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; }
.performance-stat { min-width:0; padding:14px; border:1px solid var(--border); border-radius:18px; background:#fff; box-shadow:var(--shadow-card); }
.performance-stat small { display:block; color:#64748b; font-size:.63rem; font-weight:750; }
.performance-stat strong { display:block; margin-top:5px; overflow-wrap:anywhere; font-size:1.35rem; line-height:1.15; font-weight:850; letter-spacing:-.04em; }
.performance-stat span { display:block; margin-top:5px; color:#94a3b8; font-size:.6rem; line-height:1.45; }
.chart-range-control { display:flex; align-items:center; gap:4px; padding:4px; border-radius:12px; background:#f1f5f9; }
.chart-range-control button { min-width:38px; min-height:32px; padding:5px 8px; border-radius:9px; color:#64748b; font-size:.67rem; font-weight:800; }
.chart-range-control button.active { color:#fff; background:#4f46e5; box-shadow:0 5px 12px rgba(79,70,229,.2); }
.performance-chart-wrap { width:100%; overflow-x:auto; padding:8px 0 2px; }
.performance-chart { display:block; width:100%; min-width:540px; height:auto; }
.performance-chart text { fill:#94a3b8; font:600 10px ui-sans-serif,system-ui,sans-serif; }
.chart-grid { stroke:#e2e8f0; stroke-width:1; stroke-dasharray:4 5; }
.chart-line { fill:none; stroke:#4f46e5; stroke-width:4; stroke-linecap:round; stroke-linejoin:round; }
.chart-dot { fill:#cbd5e1; stroke:#fff; stroke-width:2; }.chart-dot.logged { fill:#4f46e5; }
.chart-note { display:flex; align-items:flex-start; gap:7px; margin-top:8px; color:#64748b; font-size:.66rem; line-height:1.5; }
.chart-note svg { flex:0 0 auto; margin-top:1px; }
.performance-detail-grid { display:grid; gap:20px; }
.category-performance-list { display:grid; gap:15px; }
.category-performance-row { display:grid; grid-template-columns:42px minmax(0,1fr); gap:12px; align-items:center; }
.category-performance-row > div > div:first-child { display:flex; justify-content:space-between; gap:12px; }
.category-performance-row strong { font-size:.78rem; }.category-performance-row b { color:#4f46e5; font-size:.74rem; }
.category-performance-row .progress-track { margin-top:8px; }
.best-day-card { position:relative; overflow:hidden; background:linear-gradient(160deg,#312e81,#4f46e5); color:#fff; }
.best-day-card::after { content:""; position:absolute; width:180px; height:180px; right:-75px; top:-75px; border-radius:999px; background:rgba(255,255,255,.08); }
.best-day-icon { position:relative; z-index:1; display:grid; place-items:center; width:54px; height:54px; border-radius:17px; color:#fbbf24; background:rgba(255,255,255,.12); }
.best-day-card .eyebrow { position:relative; z-index:1; margin-top:18px; color:#c7d2fe; }
.best-day-card h2 { position:relative; z-index:1; margin-top:5px; font-size:1.35rem; font-weight:850; }
.best-day-card > strong { position:relative; z-index:1; display:block; margin-top:3px; color:#fbbf24; font-size:1.8rem; }
.best-day-card > p:not(.eyebrow) { position:relative; z-index:1; margin-top:10px; max-width:45ch; color:#e0e7ff; font-size:.75rem; line-height:1.6; }
.best-day-card .btn { position:relative; z-index:1; }

/* Penalty dashboard and ledger */
.penalty-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.penalty-summary-grid > article { min-width:0; display:flex; align-items:center; gap:9px; padding:12px 10px; border:1px solid var(--border); border-radius:17px; background:#fff; box-shadow:var(--shadow-card); }
.penalty-summary-grid article > div { min-width:0; }
.penalty-summary-grid small { display:block; color:#64748b; font-size:.58rem; line-height:1.3; }
.penalty-summary-grid strong { display:block; margin-top:3px; font-size:1.15rem; line-height:1; font-weight:850; }
.penalty-total-groups { display:grid; gap:10px; }
.penalty-total-chip { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:3px 12px; padding:13px 14px; border:1px solid #fecdd3; border-radius:15px; background:#fff7f8; }
.penalty-total-chip span { color:#9f1239; font-size:.72rem; font-weight:750; }.penalty-total-chip strong { color:#be123c; font-size:.86rem; }.penalty-total-chip small { grid-column:1/-1; color:#64748b; font-size:.62rem; }
.penalty-clear-state { display:flex; align-items:center; gap:8px; padding:14px; border:1px solid #a7f3d0; border-radius:15px; color:#047857; background:#ecfdf5; font-size:.74rem; font-weight:750; }
.penalty-filter-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; padding:5px; border:1px solid var(--border); border-radius:15px; background:#fff; }
.penalty-filter-tabs button { min-width:0; min-height:38px; border-radius:11px; color:#64748b; font-size:.66rem; font-weight:800; }
.penalty-filter-tabs button.active { color:#fff; background:#4f46e5; box-shadow:0 6px 14px rgba(79,70,229,.18); }
.penalty-card-list { display:grid; gap:14px; }
.penalty-card { padding:16px; border:1px solid #fecdd3; border-radius:20px; background:#fff; box-shadow:var(--shadow-card); }
.penalty-card.settled { border-color:#a7f3d0; background:#fbfffd; }
.penalty-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.target-icon.penalty { color:#e11d48; background:#fff1f2; }
.penalty-card.settled .target-icon.penalty { color:#059669; background:#ecfdf5; }
.penalty-card h3 { margin-top:2px; overflow-wrap:anywhere; font-size:.9rem; font-weight:850; }
.penalty-obligation { margin-top:15px; padding:14px; border-radius:15px; color:#fff; background:linear-gradient(135deg,#be123c,#e11d48); }
.penalty-card.settled .penalty-obligation { background:linear-gradient(135deg,#047857,#059669); }
.penalty-obligation small { display:block; font-size:.62rem; opacity:.8; }.penalty-obligation strong { display:block; margin-top:4px; font-size:1.35rem; letter-spacing:-.03em; }
.penalty-evidence-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-top:12px; }
.penalty-evidence-grid div { min-width:0; padding:10px; border-radius:12px; background:#f8fafc; }
.penalty-evidence-grid span { display:block; color:#64748b; font-size:.58rem; }.penalty-evidence-grid strong { display:block; margin-top:3px; overflow-wrap:anywhere; font-size:.67rem; line-height:1.4; }
.penalty-completed-note { display:flex; align-items:center; gap:7px; margin-top:13px; color:#047857; font-size:.68rem; font-weight:700; }

/* Checkout schedule settings */
.setting-toggle-row { position:relative; display:grid; grid-template-columns:minmax(0,1fr) 48px; align-items:center; gap:14px; padding:14px; border:1px solid var(--border); border-radius:16px; background:#f8fafc; cursor:pointer; }
.setting-toggle-row span:first-child { min-width:0; }
.setting-toggle-row strong,.setting-toggle-row small { display:block; }.setting-toggle-row strong { color:#334155; font-size:.76rem; }.setting-toggle-row small { margin-top:3px; color:#64748b; font-size:.65rem; line-height:1.45; }
.toggle-input { position:absolute; opacity:0; pointer-events:none; }
.toggle-ui { position:relative; width:46px; height:27px; border-radius:999px; background:#cbd5e1; transition:background .2s ease; }
.toggle-ui::after { content:""; position:absolute; left:3px; top:3px; width:21px; height:21px; border-radius:999px; background:#fff; box-shadow:0 2px 6px rgba(15,23,42,.2); transition:transform .2s ease; }
.toggle-input:checked + .toggle-ui { background:#4f46e5; }.toggle-input:checked + .toggle-ui::after { transform:translateX(19px); }
.toggle-input:focus-visible + .toggle-ui { outline:3px solid rgba(79,70,229,.22); outline-offset:2px; }
.checkout-preview { display:flex; align-items:flex-start; gap:10px; padding:13px; border:1px solid #c7d2fe; border-radius:15px; color:#3730a3; background:#eef2ff; }
.checkout-preview.disabled { color:#475569; border-color:#e2e8f0; background:#f8fafc; }
.checkout-preview svg { flex:0 0 auto; margin-top:1px; }.checkout-preview strong,.checkout-preview p { display:block; }.checkout-preview strong { font-size:.74rem; }.checkout-preview p { margin-top:3px; font-size:.65rem; line-height:1.5; }
.settings-save-bar { position:sticky; bottom:calc(76px + env(safe-area-inset-bottom)); z-index:12; margin-top:0; padding:12px; border:1px solid var(--border); border-radius:18px; background:rgba(255,255,255,.94); box-shadow:0 14px 34px rgba(15,23,42,.10); backdrop-filter:blur(14px); }

@media (max-width:359px) {
  .icon-choice-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .dashboard-insight-card { grid-template-columns:40px minmax(0,1fr) 20px; padding:13px; }
  .dashboard-shortcut-card { grid-template-columns:38px minmax(0,1fr) 16px; padding:12px; }
  .penalty-summary-grid { grid-template-columns:minmax(0,1fr); }
  .performance-stat-grid { grid-template-columns:minmax(0,1fr); }
  .penalty-card-head { display:grid; grid-template-columns:minmax(0,1fr); }
  .penalty-card-head .badge { justify-self:start; }
  .penalty-evidence-grid { grid-template-columns:minmax(0,1fr); }
}

@media (min-width:480px) {
  .dashboard-shortcut-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .icon-choice-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .performance-stat-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .penalty-card-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (min-width:768px) {
  .psychology-card { grid-template-columns:64px minmax(0,1fr); padding:26px; }
  .psychology-icon { width:64px; height:64px; border-radius:20px; }
  .psychology-card h2 { font-size:1.45rem; }
  .performance-detail-grid { grid-template-columns:minmax(0,1.25fr) minmax(280px,.75fr); }
  .penalty-total-groups { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (min-width:1024px) {
  .settings-save-bar { bottom:24px; flex-direction:row; justify-content:flex-end; }
  .settings-save-bar .btn { width:auto; }
  .performance-chart { min-width:0; }
}

@media (prefers-reduced-motion:reduce) {
  .swipe-chevron { animation:none; }
  .swipe-knob,.swipe-fill,.icon-choice { transition:none; }
}
.penalty-load-more { grid-column:1/-1; width:100%; margin-top:2px; }
