/* ==========================================================================
   SUK00N — Account, Profile & Admin components
   Extends the Sukoon design system (sukoon.css must load first).
   ========================================================================== */

/* ---------- Auth: stepper ---------- */
.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s-6); }
.step-node { display: flex; align-items: center; gap: 8px; }
.step-node .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 0.82rem; font-weight: 700; background: var(--paper-2); color: var(--faint); border: 1px solid var(--line); transition: all 0.3s var(--ease); }
.step-node.active .dot { background: var(--sage-700); color: #fff; border-color: var(--sage-700); }
.step-node.done .dot { background: var(--sage); color: #fff; border-color: var(--sage); }
.step-node .lbl { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.step-node.active .lbl { color: var(--ink); }
.step-line { flex: 1; height: 2px; background: var(--line); border-radius: 2px; min-width: 12px; }
.step-line.done { background: var(--sage); }
@media (max-width: 640px) { .step-node .lbl { display: none; } }

.step-panel { display: none; }
.step-panel.active { display: block; animation: fadeUp 0.4s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Choice chips (multi/single select) ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; cursor: pointer; transition: all 0.25s var(--ease); font-size: 0.92rem; font-weight: 500; text-align: left; }
.choice:hover { border-color: var(--sage); transform: translateY(-2px); }
.choice[aria-pressed="true"] { border-color: var(--sage-700); background: linear-gradient(180deg, #fff, #f2f8f2); box-shadow: var(--sh-1); }
.choice .tick { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 0.62rem; color: #fff; flex-shrink: 0; transition: all 0.2s; }
.choice[aria-pressed="true"] .tick { background: var(--sage-700); border-color: var(--sage-700); }
.choice .ico { color: var(--sage-700); width: 18px; text-align: center; }

/* ---------- Password strength ---------- */
.pw-meter { display: flex; gap: 5px; margin-top: 8px; }
.pw-seg { flex: 1; height: 5px; border-radius: 4px; background: var(--line); transition: background 0.3s; }
.pw-meter[data-score="1"] .pw-seg:nth-child(-n+1) { background: #d98b6b; }
.pw-meter[data-score="2"] .pw-seg:nth-child(-n+2) { background: #e7c98b; }
.pw-meter[data-score="3"] .pw-seg:nth-child(-n+3) { background: #a8c7d8; }
.pw-meter[data-score="4"] .pw-seg { background: var(--sage-600); }
.pw-hint { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }

/* Inline form validation + messages */
.form-msg { font-size: 0.82rem; margin-top: 6px; display: none; }
.form-msg.error { color: #b4573a; display: block; }
.form-msg.ok { color: var(--sage-700); display: block; }
.field.invalid { border-color: #d98b6b; box-shadow: 0 0 0 4px rgba(217,139,107,0.14); }
.alert { padding: 12px 16px; border-radius: var(--r-md); font-size: 0.88rem; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.alert i { margin-top: 2px; }
.alert.error { background: rgba(217,139,107,0.12); border: 1px solid rgba(217,139,107,0.3); color: #8f452c; }
.alert.info { background: rgba(168,199,216,0.16); border: 1px solid rgba(168,199,216,0.4); color: #3f6274; }
.alert.ok { background: rgba(139,175,155,0.14); border: 1px solid rgba(139,175,155,0.3); color: var(--sage-700); }

/* Button loading state */
.btn.loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.btn-soft.loading::after, .btn-ghost.loading::after { border-color: rgba(23,34,29,0.3); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Profile shell — "My Sukoon"
   ========================================================================== */
.acct { padding-top: var(--nav-h); }
.profile-header { position: relative; overflow: hidden; background: var(--grad-ink); color: #eef3ee; padding: calc(var(--s-8)) 0 var(--s-9); }
.profile-header::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(45% 40% at 15% 10%, rgba(168,199,216,0.22), transparent 60%),
  radial-gradient(40% 40% at 90% 90%, rgba(231,201,139,0.16), transparent 60%); }
.ph-inner { position: relative; z-index: 2; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ph-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--grad-orb); display: grid; place-items: center; font-family: var(--font-display); font-size: 2rem; color: #17332a; box-shadow: var(--sh-orb); overflow: hidden; flex-shrink: 0; position: relative; }
.ph-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ph-greet { font-size: clamp(1.6rem, 3vw, 2.4rem); color: #f4f7f1; line-height: 1.1; }
.ph-sub { color: #c3d1c8; font-size: 0.95rem; margin-top: 4px; }
.ph-summary { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: var(--s-6); }
.ph-stat { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-md); padding: 16px 18px; }
.ph-stat b { display: block; font-family: var(--font-display); font-size: 1.7rem; color: #fff; line-height: 1.1; }
.ph-stat span { font-size: 0.78rem; color: #b7c6bc; }

.profile-body { margin-top: calc(var(--s-8) * -1); position: relative; z-index: 3; padding-bottom: var(--s-9); }
.profile-layout { display: grid; grid-template-columns: 250px 1fr; gap: var(--s-6); align-items: start; }

.profile-nav { position: sticky; top: calc(var(--nav-h) + 16px); background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 12px; box-shadow: var(--sh-1); }
.profile-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm); color: var(--ink-soft); font-weight: 500; font-size: 0.92rem; transition: background 0.2s, color 0.2s; cursor: pointer; }
.profile-nav a i { width: 18px; text-align: center; color: var(--faint); }
.profile-nav a:hover { background: var(--paper-2); }
.profile-nav a.active { background: rgba(139,175,155,0.14); color: var(--sage-700); }
.profile-nav a.active i { color: var(--sage-700); }
.profile-nav .sep { height: 1px; background: var(--line-soft); margin: 8px 6px; }
.profile-nav a.danger:hover { color: #b4573a; }

.panel { display: none; }
.panel.active { display: block; animation: fadeUp 0.35s var(--ease); }
.panel > .card { margin-bottom: var(--s-5); }
.panel h2 { font-size: 1.5rem; margin-bottom: 4px; }
.panel .panel-sub { color: var(--muted); margin-bottom: var(--s-5); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--s-4); }
.section-title h3 { font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; }

/* Stat cards row */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-1); }
.stat-card .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(139,175,155,0.14); color: var(--sage-700); margin-bottom: 12px; }
.stat-card b { font-family: var(--font-display); font-size: 1.8rem; color: var(--ink); display: block; line-height: 1; }
.stat-card span { font-size: 0.82rem; color: var(--muted); }

/* Mood picker */
.mood-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.mood-opt { width: 62px; height: 72px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; transition: all 0.25s var(--ease); }
.mood-opt .emo { font-size: 1.7rem; }
.mood-opt .lbl { font-size: 0.66rem; color: var(--muted); font-weight: 600; }
.mood-opt:hover { transform: translateY(-3px); border-color: var(--sage); }
.mood-opt[aria-pressed="true"] { border-color: var(--sage-700); background: linear-gradient(180deg,#fff,#f2f8f2); box-shadow: var(--sh-1); }

/* Timeline / journey */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-row { display: flex; align-items: center; gap: 14px; padding: 14px 8px; border-bottom: 1px solid var(--line-soft); }
.tl-row:last-child { border-bottom: none; }
.tl-emo { font-size: 1.5rem; width: 40px; text-align: center; }
.tl-day { font-weight: 600; min-width: 92px; }
.tl-mood { color: var(--muted); }
.tl-note { color: var(--faint); font-size: 0.85rem; font-style: italic; margin-left: auto; text-align: right; }

/* Goals */
.goal { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-1); }
.goal + .goal { margin-top: 12px; }
.goal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.goal h4 { font-size: 1.02rem; font-weight: 700; }
.goal p { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.progress-line { height: 8px; border-radius: 8px; background: var(--paper-2); overflow: hidden; margin: 14px 0 8px; }
.progress-line > span { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--sage), var(--sage-600)); transition: width 0.6s var(--ease); }
.goal-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--muted); }

/* Switches */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.switch-row:last-child { border-bottom: none; }
.switch-row .txt b { display: block; font-weight: 600; font-size: 0.95rem; }
.switch-row .txt span { font-size: 0.83rem; color: var(--muted); }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background 0.25s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform 0.25s var(--ease); }
.switch input:checked ~ .track { background: var(--sage-600); }
.switch input:checked ~ .thumb { transform: translateX(20px); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--sage-700); outline-offset: 2px; }

/* Favorites grid */
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.fav { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-1); }
.fav .art { height: 96px; display: grid; place-items: center; color: #fff; font-size: 1.6rem; }
.fav .meta { padding: 14px; }
.fav .meta h4 { font-size: 0.92rem; font-weight: 700; }
.fav .meta span { font-size: 0.78rem; color: var(--muted); }
.fav .meta .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* Toolbar (search/filter/sort) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: var(--s-4); }
.toolbar .field, .toolbar select { max-width: 240px; padding: 10px 14px; }
.toolbar .grow { flex: 1; min-width: 160px; max-width: none; }
select.field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6b62' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }

/* Data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--sh-1); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { text-align: left; padding: 14px 16px; font-size: 0.88rem; border-bottom: 1px solid var(--line-soft); }
table.data th { font-weight: 700; color: var(--ink-soft); background: var(--card-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--paper-2); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.badge .d { width: 6px; height: 6px; border-radius: 50%; }
.badge.green { background: rgba(139,175,155,0.16); color: var(--sage-700); } .badge.green .d { background: var(--sage-600); }
.badge.gold  { background: rgba(231,201,139,0.18); color: var(--gold-600); } .badge.gold .d { background: var(--gold-600); }
.badge.sky   { background: rgba(168,199,216,0.2); color: #3f6274; } .badge.sky .d { background: var(--sky-600); }
.badge.gray  { background: rgba(23,34,29,0.06); color: var(--muted); } .badge.gray .d { background: var(--faint); }
.badge.red   { background: rgba(217,139,107,0.16); color: #8f452c; } .badge.red .d { background: #c8795a; }

.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 0.8rem; transition: all 0.2s; }
.row-actions button:hover { border-color: var(--sage); color: var(--sage-700); }
.row-actions button.danger:hover { border-color: #d98b6b; color: #b4573a; }

/* Empty + skeleton states */
.empty { text-align: center; padding: var(--s-7) var(--s-4); color: var(--muted); }
.empty .ico { width: 64px; height: 64px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-size: 1.5rem; color: var(--sage); margin: 0 auto 16px; }
.empty h3 { font-family: var(--font-body); font-weight: 700; margin-bottom: 6px; }
.skeleton { position: relative; overflow: hidden; background: var(--paper-2); border-radius: var(--r-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; margin: 8px 0; }
.sk-card { height: 96px; }

/* Segmented control */
.segmented { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.segmented button { padding: 8px 16px; border-radius: 999px; font-size: 0.84rem; font-weight: 600; color: var(--muted); }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: var(--sh-1); }

/* ==========================================================================
   Admin shell — professional SaaS CMS
   ========================================================================== */
.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: var(--paper); }
.admin-side { background: var(--ink); color: #cbd7cf; padding: 20px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-display); font-size: 1.2rem; padding: 6px 10px 16px; }
.admin-brand .mark { width: 26px; height: 26px; border-radius: 50%; background: var(--grad-orb); }
.admin-side a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm); color: #b9c7bf; font-weight: 500; font-size: 0.9rem; cursor: pointer; transition: background 0.2s, color 0.2s; }
.admin-side a i { width: 18px; text-align: center; }
.admin-side a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.admin-side a.active { background: rgba(139,175,155,0.22); color: #fff; }
.admin-side .badge-role { margin-top: auto; font-size: 0.72rem; color: #8ba095; padding: 10px; border-top: 1px solid rgba(255,255,255,0.1); }
.admin-main { min-width: 0; }
.admin-top { height: 64px; background: var(--card); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 5; }
.admin-top h1 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 700; }
.admin-content { padding: 24px; }
.admin-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.admin-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-1); }
.admin-card .lbl { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.admin-card b { font-family: var(--font-display); font-size: 2rem; color: var(--ink); display: block; margin-top: 8px; line-height: 1; }
.admin-card .trend { font-size: 0.78rem; color: var(--sage-700); margin-top: 6px; }
.admin-panel { display: none; }
.admin-panel.active { display: block; animation: fadeUp 0.3s var(--ease); }

/* Bars chart (accessible, CSS) */
.barchart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding: 12px 0; }
.barchart .bar { flex: 1; background: linear-gradient(180deg, var(--sage), var(--sage-600)); border-radius: 8px 8px 0 0; position: relative; min-height: 4px; transition: height 0.7s var(--ease); }
.barchart .bar span { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 0.72rem; color: var(--muted); }
.barchart .bar b { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 0.72rem; color: var(--ink); font-weight: 700; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 8px; }
  .profile-nav a { white-space: nowrap; }
  .profile-nav .sep { display: none; }
  .profile-nav a.hide-mobile { display: none; }
  .ph-summary, .stat-row { grid-template-columns: repeat(2, 1fr); }
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; transform: translateX(-100%); transition: transform 0.3s var(--ease); z-index: 60; height: 100vh; }
  .admin.nav-open .admin-side { transform: none; }
  .admin-burger { display: inline-flex !important; }
  .admin-cards { grid-template-columns: repeat(2, 1fr); }
}
.admin-burger { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); align-items: center; justify-content: center; }
@media (max-width: 560px) {
  .ph-summary, .stat-row, .admin-cards { grid-template-columns: 1fr 1fr; }
  .profile-header { padding-top: var(--s-7); }
  .choice-grid { grid-template-columns: 1fr; }
}

/* ---------- Focus panel (§17) -------------------------------------------- */
.fx-card { text-align: center; }
.fx-ring {
  --deg: 0deg;
  width: 190px; height: 190px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--sage-700) var(--deg, 0deg), var(--paper-2) 0deg);
  transition: background 0.6s var(--ease, ease);
  margin-inline: auto;
}
.fx-core {
  width: 158px; height: 158px; border-radius: 50%;
  background: var(--card, #fff);
  display: grid; place-items: center; align-content: center; gap: 4px;
  box-shadow: var(--sh-1, 0 1px 4px rgba(23,34,29,0.10));
}
.fx-clock { font-family: var(--font-display, serif); font-size: 2.1rem; font-weight: 600; color: var(--ink, #17221d); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .fx-ring { transition: none; }
}
