/* ============================================================
   THE'Y Client Portal — application styles (components only).
   Tokens come from tokens.css. Zero framework. Premium/calm register.
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body); line-height: 1.6;
  background: var(--surface); color: var(--text-1);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--text-2); }
.label { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.muted { color: var(--text-2); }
.tnum { font-variant-numeric: tabular-nums; }
.h1 { font-weight: 300; font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -0.02em; }
.h2 { font-weight: 300; font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.01em; }
.h3 { font-weight: 500; font-size: var(--fs-h3); line-height: 1.3; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; line-height: 1; transition: background var(--t-micro) var(--ease-out), color var(--t-micro), border-color var(--t-micro), transform var(--t-micro); }
.btn .arrow { transition: transform var(--t-micro) var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--text-1); color: var(--surface); }
.btn-ghost { border: 1px solid var(--line); color: var(--text-1); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--text-1) 40%, transparent); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface-raised); border-inline-end: 1px solid var(--line);
  padding: var(--sp-6) var(--sp-4); display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 18px; font-weight: 300; letter-spacing: .3em; padding: 0 var(--sp-3) var(--sp-6); }
.brand b { font-weight: 800; letter-spacing: 0; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px var(--sp-3); border-radius: var(--r-sm);
  color: var(--text-2); font-size: 14px; transition: color var(--t-micro), background var(--t-micro); }
.nav-link:hover { color: var(--text-1); }
.nav-link[aria-current="page"] { color: var(--text-1); background: var(--surface-card); }
.nav-link svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-spacer { flex: 1; }
.nav-sep { height: 1px; background: var(--line); margin: var(--sp-3) var(--sp-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-5) var(--margin); border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(12px); z-index: 20; }
.topbar-title { font-weight: 300; font-size: 22px; letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); position: relative; transition: color var(--t-micro); }
.icon-btn:hover { color: var(--text-1); }
.icon-btn svg { width: 18px; height: 18px; }
.bell-dot { position: absolute; top: 8px; inset-inline-end: 9px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 9px; font-weight: 700; display: grid; place-items: center; }
.content { padding: var(--sp-7) var(--margin) var(--sp-9); max-width: 1100px; width: 100%; }

/* ---------- reveal (pure CSS, no JS dependency) ---------- */
.rise { animation: rise var(--t-reveal) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- cards, lists, primitives ---------- */
.card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-6); }
.grid { display: grid; gap: var(--sp-5); }
.g-2 { grid-template-columns: 2fr 1fr; }
.section-label { display: block; margin-bottom: var(--sp-4); }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) 0; border-top: 1px solid var(--line); }
.list-row:last-child { border-bottom: 1px solid var(--line); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-size: 15px; }
.list-row a.title:hover { color: var(--text-2); }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.err { background: var(--err); } .dot.accent { background: var(--accent); }

.meter { height: 3px; background: var(--surface-card); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); transition: width var(--t-reveal) var(--ease-out); }

/* timeline */
.timeline { position: relative; padding-inline-start: 20px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: var(--sp-3) 0; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -20px; top: 18px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface-card); border: 1px solid var(--text-2); }
.tl-item.done::before { background: var(--accent); border-color: var(--accent); }
.tl-item.doing::before { border-color: var(--accent); }
.tl-item .when { margin-inline-start: var(--sp-3); }

/* file / deliverable card */
.file-card { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface-raised); transition: border-color var(--t-micro); }
.file-card:hover { border-color: color-mix(in srgb, var(--text-1) 30%, transparent); }
.file-frame { aspect-ratio: 16/10; background: var(--surface-card); display: grid; place-items: center; color: var(--text-2); }
.file-body { padding: var(--sp-4); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }

/* approve bar */
.approve-bar { position: sticky; bottom: var(--sp-5); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  background: var(--surface-card); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-1); }

/* slots */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--sp-3); }
.slot-day { border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--sp-4); }
.slot-day h4 { font-size: 13px; font-weight: 500; margin-bottom: var(--sp-3); }
.slot { display: block; width: 100%; text-align: center; padding: 8px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-1); transition: all var(--t-micro); font-variant-numeric: tabular-nums; }
.slot:hover { border-color: var(--accent); }
.slot[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* forms */
.field { margin-bottom: var(--sp-5); }
.field label { display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); margin-bottom: var(--sp-2); }
.field input, .field textarea { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text-1);
  font-family: var(--font-sans); font-size: 18px; padding: 9px 0; transition: border-color var(--t-micro); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }

/* empty / toast / dialog */
.empty { text-align: center; color: var(--text-2); padding: var(--sp-9) var(--sp-5); }
.empty .h3 { color: var(--text-1); margin-bottom: var(--sp-3); }
.toast-wrap { position: fixed; bottom: var(--sp-6); inset-inline-end: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); z-index: 100; }
.toast { background: var(--surface-card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-5);
  box-shadow: var(--shadow-1); animation: rise var(--t-micro) var(--ease-out) both; font-size: 14px; }
.toast.err { border-color: var(--err); }
dialog { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-raised); color: var(--text-1); padding: var(--sp-6); max-width: 440px; width: calc(100% - 40px); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }

/* login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand { display: flex; flex-direction: column; justify-content: center; gap: var(--sp-5); padding: var(--margin); padding-inline: clamp(40px, 6vw, 96px); }
.auth-brand .stmt { font-weight: 300; font-size: clamp(30px, 4vw, 52px); line-height: 1.1; letter-spacing: -0.02em; max-width: 14ch; }
.auth-form { display: flex; flex-direction: column; justify-content: center; gap: var(--sp-4); padding-inline: clamp(40px, 5vw, 72px); border-inline-start: 1px solid var(--line); }
@media (max-width: 820px) { .auth-wrap { grid-template-columns: 1fr; } .auth-brand { display: none; } }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-raised), var(--surface-card), var(--surface-raised)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- responsive: mobile shell ---------- */
.menu-btn, .mobile-tabbar { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 60; transform: translateX(-100%); transition: transform var(--t-micro) var(--ease-move); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
  .menu-btn { display: grid; }
  .content { padding-bottom: 96px; }
  .mobile-tabbar { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 8px 0; justify-content: space-around; }
  .mobile-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--text-2); padding: 4px 10px; }
  .mobile-tabbar a[aria-current="page"] { color: var(--text-1); }
  .mobile-tabbar svg { width: 20px; height: 20px; }
  .g-2 { grid-template-columns: 1fr; }
  .auth-form { border: 0; }
}

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