/* =========================================================
   AimIT - graphite + neural cyan (A.I.M's Solution theme)
   ========================================================= */
:root {
  --bg: #0f1215;
  --bg-2: #14181c;
  --surface: #1a1f24;
  --surface-2: #20262c;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --text: #e8ecef;
  --muted: #8b96a1;
  --dim: #4b555e;
  --cyan: #2fd8ea;
  --cyan-soft: rgba(47, 216, 234, .12);
  --ink: #05161a;
  --silver: #c9cfd6;
  --green: #6dfc3c;
  --red: #ff7070;
  --amber: #ffc857;
  --violet: #b392ff;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --notch: 12px;
  --side-w: 264px;
  --top-h: 68px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9990;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0 0 .4em; letter-spacing: -.03em; }
h1 em, h2 em, h3 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--cyan); letter-spacing: -.01em; padding-right: .04em; }
p { margin: 0 0 1em; }
::selection { background: var(--cyan); color: var(--ink); }
[data-lucide], svg.lucide { width: 1.1em; height: 1.1em; stroke-width: 1.75; flex-shrink: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- Label ---------- */
.label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
}
.label .idx { color: var(--cyan); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px;
  padding: 0 20px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: color .4s var(--ease), border-color .4s, opacity .2s;
}
.btn::before {
  content: '';
  position: absolute; inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .55s var(--ease);
}
.btn:hover::before { transform: scaleX(1); transform-origin: left; }
.btn svg { transition: transform .45s var(--ease); }
.btn:hover svg.arrow { transform: translate(3px, -3px); }
.btn-primary, .btn-danger-solid { clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%); }
.btn-primary { background: var(--cyan); color: var(--ink); }
.btn-primary::before { background: var(--text); }
.btn-ghost { border: 1px solid var(--line-2); color: var(--text); }
.btn-ghost::before { background: var(--cyan); }
.btn-ghost:hover { color: var(--ink); border-color: var(--cyan); }
.btn-danger { border: 1px solid rgba(255, 112, 112, .35); color: var(--red); }
.btn-danger::before { background: var(--red); }
.btn-danger:hover { color: var(--ink); border-color: var(--red); }
.btn-danger-solid { background: var(--red); color: var(--ink); }
.btn-danger-solid::before { background: var(--text); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 11px; gap: 8px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 10.5px; gap: 6px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); display: inline-grid; place-items: center; transition: border-color .3s, color .3s, background .3s; }
.btn-icon:hover { border-color: var(--cyan); color: var(--cyan); }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--silver);
  white-space: nowrap;
}
.chip-cyan { border-color: rgba(47, 216, 234, .45); color: var(--cyan); background: var(--cyan-soft); }
.chip-green { border-color: rgba(109, 252, 60, .35); color: var(--green); background: rgba(109, 252, 60, .07); }
.chip-amber { border-color: rgba(255, 200, 87, .35); color: var(--amber); background: rgba(255, 200, 87, .07); }
.chip-red { border-color: rgba(255, 112, 112, .35); color: var(--red); background: rgba(255, 112, 112, .07); }
.chip-violet { border-color: rgba(179, 146, 255, .35); color: var(--violet); background: rgba(179, 146, 255, .07); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 216, 234, .6); } 70% { box-shadow: 0 0 0 8px rgba(47, 216, 234, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 216, 234, 0); } }

/* =========================================================
   App shell
   ========================================================= */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 60;
  transition: transform .5s var(--ease);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  height: var(--top-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--cyan); color: var(--ink);
  font-family: var(--mono); font-weight: 600; font-size: 13px;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
}
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: -.03em; }
.brand-name em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--cyan); }
.nav { flex: 1; overflow-y: auto; padding: 18px 12px; }
.nav-group { margin-bottom: 22px; }
.nav-group > .label { padding: 0 12px; margin-bottom: 8px; font-size: 10.5px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  color: var(--silver);
  font-size: 14.5px;
  transition: color .3s, background .3s;
}
.nav a::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--cyan);
  transform: scaleY(0); transition: transform .4s var(--ease);
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.nav a.active { color: var(--cyan); background: var(--cyan-soft); }
.nav a.active::before { transform: scaleY(1); }
.nav a .count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; background: var(--red); color: var(--ink); padding: 1px 7px; font-weight: 600; }
.side-user {
  border-top: 1px solid var(--line);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 12px; color: var(--cyan);
}
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 32px;
  background: rgba(15, 18, 21, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.menu-toggle { display: none; }
.top-search { flex: 1; max-width: 520px; position: relative; }
.top-search input {
  width: 100%; height: 42px;
  padding: 0 14px 0 42px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono); font-size: 12.5px;
  outline: none;
  transition: border-color .3s, background .3s;
}
.top-search input:focus { border-color: var(--cyan); background: var(--surface); }
.top-search > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search .scope {
  position: absolute; right: 6px; top: 6px; bottom: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--silver);
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  padding: 0 8px; outline: none;
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bell { position: relative; }
.bell .badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--cyan); color: var(--ink);
  font-family: var(--mono); font-size: 10px; font-weight: 600;
}
.content { padding: 32px; flex: 1; width: 100%; max-width: 1480px; }
.footer { padding: 18px 32px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.scrim { position: fixed; inset: 0; background: rgba(5, 7, 9, .7); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .4s; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(30px, 4vw, 46px); margin: 10px 0 0; }
.page-head p { color: var(--muted); margin: 8px 0 0; max-width: 620px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Grid / cards ---------- */
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 32px; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 22px;
  min-width: 0;
}
.card.notched { clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h3 { font-size: 19px; margin: 0; }
.card-flush { padding: 0; }
.card-flush .card-head { padding: 20px 22px 0; }

.stat { display: flex; flex-direction: column; gap: 10px; overflow: hidden; transition: border-color .4s; }
.stat:hover { border-color: var(--line-2); }
.stat .value { font-size: clamp(26px, 3vw, 36px); font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.stat .sub { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .ic { position: absolute; right: 18px; top: 18px; color: var(--dim); }
.stat .ic svg { width: 22px; height: 22px; }
.stat.accent { background: var(--cyan); color: var(--ink); border-color: var(--cyan); clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%); }
.stat.accent .label, .stat.accent .sub, .stat.accent .ic { color: rgba(5, 22, 26, .65); }
.stat::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--cyan); transform: scaleX(0); transform-origin: left; transition: transform .7s var(--ease);
}
.stat:hover::after { transform: scaleX(1); }
.stat.accent::after { background: var(--ink); }

/* ---------- Bar chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar .fill {
  width: 100%; max-width: 38px;
  background: linear-gradient(180deg, var(--cyan), rgba(47, 216, 234, .25));
  min-height: 2px;
  transform-origin: bottom; transform: scaleY(0);
  animation: grow 1s var(--ease) forwards;
  position: relative;
}
.bar .fill.zero { background: var(--line-2); }
.bar .fill:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--ink); padding: 3px 7px;
  font-family: var(--mono); font-size: 10.5px; white-space: nowrap; z-index: 3;
}
.bar span { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.bar span i { font-style: normal; }
@keyframes grow { to { transform: scaleY(1); } }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-family: var(--mono); font-weight: 500; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .25s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.table .amount { font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 32px; height: 32px; font-size: 11px; }
.person small { display: block; color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.thumb { width: 42px; height: 42px; object-fit: cover; border: 1px solid var(--line-2); cursor: zoom-in; transition: border-color .3s; }
.thumb:hover { border-color: var(--cyan); }

/* ---------- List rows ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .grow small { color: var(--muted); font-size: 12.5px; }
.rank { font-family: var(--mono); font-size: 12px; color: var(--cyan); width: 26px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field > .label-text {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.field > label .req { color: var(--cyan); }
.input, .select, .textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--display); font-size: 15px;
  outline: none;
  border-radius: 0;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b96a1' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--cyan); background: var(--surface); box-shadow: 0 0 0 3px var(--cyan-soft); }
.input.is-invalid, .select.is-invalid { border-color: var(--red); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 42px; }
.input-icon .toggle-pass { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); padding: 6px; }
.input-icon .toggle-pass:hover { color: var(--cyan); }
.error { color: var(--red); font-size: 12.5px; font-family: var(--mono); }
.hint { color: var(--muted); font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--silver); }
.check input { width: 16px; height: 16px; accent-color: var(--cyan); }
.inline-form { display: inline; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .input, .filters .select { height: 42px; font-size: 14px; }
.filters .field { min-width: 150px; flex: 1; }
.filters .field.narrow { flex: 0 0 auto; min-width: 120px; }

/* Payment method picker */
.methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.method {
  position: relative; cursor: pointer; text-align: left; width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  transition: border-color .3s, background .3s, transform .3s var(--ease);
}
.method:hover { border-color: rgba(47, 216, 234, .5); transform: translateY(-2px); }
.method input { position: absolute; opacity: 0; pointer-events: none; }
.method .mi { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--muted); flex-shrink: 0; transition: all .3s; }
.method strong { font-size: 14px; font-weight: 600; line-height: 1.2; }
.method small { display: block; color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.method:has(input:checked) { border-color: var(--cyan); background: var(--cyan-soft); }
.method.open { border-color: var(--cyan); background: var(--cyan-soft); }
.method.open .mi, .method:has(input:checked) .mi { background: var(--cyan); color: var(--ink); border-color: var(--cyan); }
.others-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; border: 1px dashed var(--line-2); animation: fadeUp .45s var(--ease); }

/* Upload */
.drop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 150px; padding: 18px;
  border: 1px dashed var(--line-2);
  background: var(--bg-2);
  text-align: center; cursor: pointer;
  transition: border-color .3s, background .3s;
}
.drop:hover, .drop.drag { border-color: var(--cyan); background: var(--cyan-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop svg { width: 28px; height: 28px; color: var(--cyan); }
.drop img.preview { max-height: 180px; border: 1px solid var(--line-2); }

/* ---------- Flash / toast ---------- */
.toasts { position: fixed; top: 84px; right: 24px; z-index: 9995; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--cyan);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  font-size: 14px;
  animation: toastIn .6s var(--ease);
}
.toast.error { border-left-color: var(--red); }
.toast.error svg { color: var(--red); }
.toast.info { border-left-color: var(--amber); }
.toast.info svg { color: var(--amber); }
.toast svg { color: var(--cyan); margin-top: 2px; }
.toast .x { margin-left: auto; color: var(--muted); }
.toast.out { animation: toastOut .4s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

.notice {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid rgba(47, 216, 234, .35);
  background: linear-gradient(90deg, var(--cyan-soft), transparent);
}
.notice.warn { border-color: rgba(255, 200, 87, .35); background: linear-gradient(90deg, rgba(255, 200, 87, .08), transparent); }
.notice.warn > svg { color: var(--amber); }
.notice > svg { color: var(--cyan); width: 22px; height: 22px; }
.notice .grow { flex: 1; min-width: 200px; }
.notice strong { display: block; }
.notice small { color: var(--muted); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--dim); margin: 0 auto 14px; }
.empty-state h3 { color: var(--text); font-size: 20px; }

/* ---------- Sheet cards ---------- */
.sheet-card { display: flex; flex-direction: column; gap: 14px; transition: border-color .4s, transform .5s var(--ease); }
.sheet-card:hover { border-color: rgba(47, 216, 234, .4); transform: translateY(-3px); }
.sheet-card .period { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.sheet-card .period em { font-family: var(--serif); font-weight: 400; font-style: italic; color: var(--cyan); }
.sheet-card .meta { display: flex; gap: 18px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.sheet-card .meta b { color: var(--text); font-weight: 500; }
.sheet-card .foot { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  position: relative; padding: 12px 18px;
  font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); white-space: nowrap; transition: color .3s;
}
.tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--cyan); transform: scaleX(0); transition: transform .45s var(--ease); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--cyan); }
.tab.active::after { transform: scaleX(1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .5s var(--ease); }

/* ---------- Spreadsheet ---------- */
.sheet-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px; border: 1px solid var(--line); border-bottom: 0; background: var(--bg-2); }
.sheet-toolbar .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.sheet-toolbar .save-state { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sheet-toolbar .save-state.saving { color: var(--amber); }
.sheet-toolbar .save-state.saved { color: var(--green); }
.sheet-toolbar .save-state.error { color: var(--red); }
.formula-bar { display: flex; border: 1px solid var(--line); border-bottom: 0; background: var(--surface); }
.formula-bar .ref { width: 70px; padding: 8px 10px; font-family: var(--mono); font-size: 12px; color: var(--cyan); border-right: 1px solid var(--line); text-align: center; }
.formula-bar input { flex: 1; background: transparent; border: 0; color: var(--text); padding: 8px 12px; font-family: var(--mono); font-size: 13px; outline: none; }
.sheet-scroll { overflow: auto; max-height: 68vh; border: 1px solid var(--line); background: var(--bg-2); }
.xl { border-collapse: separate; border-spacing: 0; font-size: 13px; table-layout: fixed; }
.xl th, .xl td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.xl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--muted);
  height: 28px; text-align: center; user-select: none;
}
.xl thead th.sel { color: var(--cyan); background: #25303a; }
.xl .rh {
  position: sticky; left: 0; z-index: 1;
  width: 48px; min-width: 48px;
  background: var(--surface-2);
  font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; user-select: none;
}
.xl .rh.sel { color: var(--cyan); background: #25303a; }
.xl thead th.corner { left: 0; z-index: 3; width: 48px; }
.xl td { padding: 0; height: 30px; background: var(--bg); position: relative; }
.xl td input {
  width: 100%; height: 100%;
  background: transparent; border: 0; outline: none;
  color: var(--text); padding: 0 8px;
  font-family: var(--display); font-size: 13px;
}
.xl td.active { outline: 2px solid var(--cyan); outline-offset: -2px; z-index: 1; }
.xl td.ro input { cursor: default; }
.xl tbody tr:first-child td input { font-weight: 700; color: var(--silver); }
.xl .resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 4; }
.xl .resize:hover { background: var(--cyan); }
.xl.sales td { padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xl.sales th:not(.corner) { text-align: left; padding: 0 10px; }
.xl.sales tbody tr:hover td { background: #141a1f; }
.xl.sales tfoot td { background: var(--surface-2); font-weight: 700; height: 34px; position: sticky; bottom: 0; }

/* ---------- Modal ---------- */
dialog.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text);
}
dialog.modal::backdrop { background: rgba(5, 7, 9, .75); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: fadeUp .45s var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; flex-wrap: wrap; }
dialog.lightbox { background: transparent; border: 0; padding: 0; max-width: 92vw; max-height: 92vh; }
dialog.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; border: 1px solid var(--line-2); }
dialog.lightbox::backdrop { background: rgba(5, 7, 9, .9); }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.pager a, .pager span { min-width: 38px; height: 38px; padding: 0 10px; display: inline-grid; place-items: center; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--silver); transition: all .3s; }
.pager a:hover { border-color: var(--cyan); color: var(--cyan); }
.pager .current { background: var(--cyan); color: var(--ink); border-color: var(--cyan); }
.pager .disabled { opacity: .35; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 60%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 60%, #000 20%, transparent 75%);
}
.auth-art .orb {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  right: -120px; bottom: -120px;
  background: radial-gradient(circle, rgba(47, 216, 234, .22), transparent 65%);
  filter: blur(10px);
  animation: float 9s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-30px, -24px); } }
.auth-art > * { position: relative; }
.auth-art h1 { font-size: clamp(40px, 5vw, 72px); letter-spacing: -.045em; margin: 0; }
.auth-art .ticker { display: flex; gap: 22px; overflow: hidden; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }
.auth-art .ticker > div { display: flex; gap: 22px; animation: marquee 26s linear infinite; }
.auth-art .ticker span::before { content: '✦'; color: var(--cyan); margin-right: 22px; }
@keyframes marquee { to { transform: translateX(-50%); } }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h2 { font-size: 36px; margin: 14px 0 6px; }
.auth-box .sub { color: var(--muted); margin-bottom: 28px; }
.auth-switch { margin-top: 22px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-switch a { color: var(--cyan); }
.link { color: var(--cyan); background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .4s var(--ease); }
.link:hover { background-size: 100% 1px; }

/* ---------- Team join cards ---------- */
.team-card { display: flex; flex-direction: column; gap: 16px; transition: border-color .4s, transform .5s var(--ease); }
.team-card:hover { border-color: rgba(47, 216, 234, .45); transform: translateY(-4px); }
.team-card .tc-top { display: flex; align-items: center; gap: 14px; }
.team-card h3 { font-size: 24px; margin: 0; }

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); transition: background .3s; }
.notif:hover { background: rgba(255, 255, 255, .025); }
.notif.unread { background: linear-gradient(90deg, var(--cyan-soft), transparent 60%); }
.notif .ni { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--cyan); flex-shrink: 0; }
.notif .grow { flex: 1; min-width: 0; }
.notif small { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

/* ---------- Reveal animation ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: fadeUp .7s var(--ease) forwards; }
.reveal:nth-child(1) { animation-delay: .03s; }
.reveal:nth-child(2) { animation-delay: .09s; }
.reveal:nth-child(3) { animation-delay: .15s; }
.reveal:nth-child(4) { animation-delay: .21s; }
.reveal:nth-child(5) { animation-delay: .27s; }
.reveal:nth-child(6) { animation-delay: .33s; }
.reveal:nth-child(n+7) { animation-delay: .38s; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .content { padding: 22px 16px; }
  .footer { padding: 16px; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .g-2, .g-3, .form-row { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 16px; }
  .stat .value { font-size: 24px; }
  .stat .ic { display: none; }
  .methods, .others-panel { grid-template-columns: minmax(0, 1fr); }
  .top-search .scope { display: none; }
  .top-search input { padding-right: 12px; }
  .page-head { margin-bottom: 20px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .bars { gap: 4px; height: 160px; }
  .bar span { font-size: 8.5px; }
  .bar span .yr { display: none; }
  .toasts { right: 16px; left: 16px; top: 76px; }
  .brand-name.top { display: none; }
  .table td, .table th { padding: 11px 12px; }
  .hide-sm { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; }
}

/* ---------- PWA install button ---------- */
.install-fab {
  position: fixed; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 9980;
  display: flex; align-items: stretch;
  background: var(--cyan); color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  animation: fabIn .7s var(--ease) both;
}
.install-fab[hidden] { display: none !important; }
.install-fab-main { display: flex; align-items: center; gap: 12px; padding: 12px 6px 12px 14px; text-align: left; color: inherit; }
.install-fab-ic { width: 36px; height: 36px; display: grid; place-items: center; background: var(--ink); color: var(--cyan); flex-shrink: 0; }
.install-fab-ic svg { animation: nudge 2.4s var(--ease) infinite; }
.install-fab-text strong { display: block; font-size: 15px; line-height: 1.1; letter-spacing: -.01em; }
.install-fab-text small { display: block; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin-top: 3px; }
.install-fab-x { padding: 0 14px 0 8px; color: inherit; opacity: .55; transition: opacity .2s; }
.install-fab-x:hover { opacity: 1; }
.install-fab-main:hover .install-fab-ic { background: #000; }
@keyframes fabIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(3px); } 90% { transform: translateY(-1px); } }
.install-steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; color: var(--silver); }
.install-steps svg { vertical-align: -3px; color: var(--cyan); }
@media (max-width: 640px) {
  .install-fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .install-fab-text small { display: none; }
}
@media (display-mode: standalone) { .install-fab { display: none !important; } }

/* ---------- Sidebar sub-menu (Payment Sheets) ---------- */
.nav-sub summary {
  position: relative; list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; color: var(--silver); font-size: 14.5px;
  transition: color .3s, background .3s;
}
.nav-sub summary::-webkit-details-marker { display: none; }
.nav-sub summary:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.nav-sub summary.active { color: var(--cyan); }
.nav-sub summary .chev { margin-left: auto; transition: transform .35s var(--ease); }
.nav-sub[open] summary .chev { transform: rotate(180deg); }
.nav-sub a { padding: 8px 12px 8px 42px; font-size: 13.5px; }
.nav-sub[open] a { animation: fadeUp .35s var(--ease) both; }

/* ---------- Payment sheet ---------- */
.day-row td { background: var(--surface-2) !important; font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.day-row td b { color: var(--cyan); font-weight: 500; }
.method-card { display: flex; flex-direction: column; gap: 10px; transition: border-color .4s, transform .5s var(--ease); }
.method-card:hover { border-color: rgba(47, 216, 234, .45); transform: translateY(-3px); }
.method-card .value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }

/* ---------- Designer work ---------- */
.task-card { display: flex; flex-direction: column; gap: 12px; transition: border-color .4s, transform .5s var(--ease); }
.task-card:hover { border-color: rgba(47, 216, 234, .45); transform: translateY(-3px); }
.task-card.overdue { border-color: rgba(255, 112, 112, .45); }
.task-card h3 { font-size: 20px; margin: 0; }
.task-snippet { font-size: 13.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; }
.task-meta span { display: inline-flex; align-items: center; gap: 6px; }
.countdown-sm, .countdown { font-family: var(--mono); color: var(--green); }
.countdown-sm.soon, .countdown.soon { color: var(--amber); }
.countdown-sm.late, .countdown.late { color: var(--red); }
.deadline-card .deadline-date { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 10px 0 6px; line-height: 1.25; }
.deadline-card .countdown { font-size: 18px; }
.deadline-card .countdown.done { color: var(--muted); font-size: 13px; }
.deadline-card.overdue { border-color: rgba(255, 112, 112, .45); }
.quick-days { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-days .chip { cursor: pointer; padding: 8px 12px; }

.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-thread { padding: 20px; overflow-y: auto; max-height: 64vh; min-height: 340px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 82%; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg-2); animation: fadeUp .4s var(--ease); }
.msg.mine { align-self: flex-end; background: rgba(47, 216, 234, .07); border-color: rgba(47, 216, 234, .28); }
.msg.theirs { align-self: flex-start; }
.msg.kind-brief { max-width: 100%; align-self: stretch; border-left: 3px solid var(--cyan); }
.msg.kind-delivery { border-left: 3px solid var(--green); }
.msg.kind-revision { border-left: 3px solid var(--red); }
.msg.kind-approval { border-left: 3px solid var(--green); }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 8px; }
.msg-head .avatar { width: 26px; height: 26px; font-size: 10px; }
.msg-head .muted { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.msg-time { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.msg-kind { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); margin-bottom: 8px; }
.kind-delivery .msg-kind, .kind-approval .msg-kind { color: var(--green); }
.kind-revision .msg-kind { color: var(--red); }
.msg-body { font-size: 14.5px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.msg-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.mf-media { margin: 0; border: 1px solid var(--line-2); background: #000; }
.mf-media img { width: 100%; height: 160px; object-fit: cover; cursor: zoom-in; }
.mf-media video { width: 100%; max-height: 260px; display: block; background: #000; }
.mf-media.mf-audio { grid-column: 1 / -1; background: var(--surface); padding: 8px; }
.mf-media.mf-audio audio { width: 100%; }
.mf-media figcaption { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 8px; background: var(--surface); font-size: 11.5px; }
.mf-media figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--silver); }
.mf-media figcaption a { color: var(--cyan); }
.mf-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); background: var(--surface); transition: border-color .3s; min-width: 0; }
.mf-file:hover { border-color: var(--cyan); }
.mf-file > svg:first-child { color: var(--cyan); width: 22px; height: 22px; }
.mf-file span { min-width: 0; flex: 1; }
.mf-file strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-file small { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.mf-file .dl { color: var(--muted); }
.mf-file.small { margin-bottom: 8px; }
.msg-actions { display: flex; gap: 14px; margin-top: 10px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.msg-actions summary, .msg-actions button { cursor: pointer; color: var(--muted); list-style: none; }
.msg-actions summary::-webkit-details-marker { display: none; }
.msg-actions summary:hover, .msg-actions button:hover { color: var(--cyan); }
.msg-actions details[open] { flex: 1; }
.msg-system { align-self: center; font-family: var(--mono); font-size: 11px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px dashed var(--line-2); text-align: center; }
.composer { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-2); }
.composer .textarea { min-height: 60px; }
.composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer .file-names { font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.upload-progress { height: 4px; background: var(--line); overflow: hidden; }
.upload-progress span { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .2s; }
@media (max-width: 640px) {
  .msg { max-width: 94%; }
  .chat-thread { max-height: 58vh; padding: 14px; }
  .msg-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mf-media img { height: 120px; }
}
