/* =============================================================
   Studio Desk — internal billing & operations
   Reuses the global design tokens from style.css (:root vars).
   Nothing here overrides the public site.
   ============================================================= */

.sd-body { background: var(--bg); color: var(--fg); }
.sd-muted { color: var(--muted); }
.sd-opt { color: var(--stone-2); font-weight: 400; }

/* ---------- Custom cursor stays above the passcode gate ----------
   The global .cursor sits at z-index 9998 and the gate overlay at
   9999, which hid the cursor on the login screen. Lift the cursor
   above the gate on Studio Desk only (scoped via .sd-body). */
.sd-body .cursor { z-index: 10000; }

/* ---------- Passcode gate ---------- */
.sd-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center; padding: var(--gutter);
  background: radial-gradient(120% 120% at 50% 0%, var(--ink-2), var(--ink));
}
.sd-gate[hidden] { display: none; }
.sd-gate__card {
  width: min(440px, 92vw);
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.8rem, 4vw, 2.8rem);
  box-shadow: 0 40px 120px rgba(0,0,0,.55);
}
.sd-gate__card .label { color: var(--accent); }
.sd-gate__card h1 { font-family: var(--display); font-size: clamp(1.8rem,4vw,2.4rem); margin: .6rem 0 .4rem; }
.sd-gate__card p { margin-bottom: 1.6rem; font-size: .95rem; }
.sd-gate__err { color: var(--clay); font-size: .85rem; min-height: 1.2em; margin-top: .9rem; }
.sd-field { margin-bottom: 1.4rem; }

/* ---------- App shell ---------- */
.sd-app { padding-top: clamp(6rem, 10vw, 8rem); padding-bottom: var(--section); min-height: 100vh; }
.sd-app[hidden] { display: none; }
.sd-head {
  display: flex; flex-wrap: wrap; gap: 1.4rem 2rem;
  align-items: flex-end; justify-content: space-between;
  padding-bottom: 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2.5rem;
}
.sd-title { font-family: var(--display); font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1; margin-top: .5rem; }

/* ---------- Tabs ---------- */
.sd-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.sd-tab {
  font-family: var(--label); font-size: .8rem; letter-spacing: .04em;
  padding: .6rem 1.1rem; border: 1px solid var(--line); background: transparent;
  color: var(--muted); border-radius: 999px; cursor: pointer;
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease);
}
.sd-tab:hover { color: var(--fg); border-color: var(--stone-2); }
.sd-tab.is-active { color: var(--ink); background: var(--accent); border-color: var(--accent); }

/* ---------- Panels ---------- */
.sd-panel { display: none; }
.sd-panel.is-active { display: block; animation: sd-fade .5s var(--ease); }
@keyframes sd-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.sd-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .sd-grid { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.sd-card {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.2rem);
}
.sd-card__title { font-family: var(--display); font-size: 1.4rem; margin-bottom: 1.4rem; }
.sd-card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.sd-card__head .sd-card__title { margin-bottom: 0; }
.sd-sub { font-family: var(--label); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 1.8rem 0 .9rem; }
.sd-summary { position: sticky; top: 6rem; }

/* ---------- Inputs ---------- */
.sd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .sd-row { grid-template-columns: 1fr; } }
.sd-inp { display: flex; flex-direction: column; margin-bottom: 1rem; }
.sd-inp label { font-family: var(--label); font-size: .72rem; letter-spacing: .05em; color: var(--muted); margin-bottom: .45rem; text-transform: uppercase; }
.sd-inp input, .sd-inp select, .sd-inp textarea {
  font-family: var(--sans); font-size: .95rem; color: var(--fg);
  background: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .7rem .8rem; width: 100%;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.sd-inp textarea { resize: vertical; line-height: 1.5; }
.sd-inp input:focus, .sd-inp select:focus, .sd-inp textarea:focus { outline: none; border-color: var(--accent); background: var(--ink-3); }
.sd-inp select option { background: var(--ink-2); color: var(--fg); }

/* ---------- Line items ---------- */
.sd-items, .sd-item {
  display: grid; grid-template-columns: 1fr 68px 110px 110px 34px; gap: .6rem; align-items: center;
}
.sd-items { font-family: var(--label); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; padding: 0 .1rem; }
.sd-item { margin-bottom: .55rem; }
.sd-item input {
  font-family: var(--sans); font-size: .9rem; color: var(--fg);
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .55rem .6rem; width: 100%;
}
.sd-item input:focus { outline: none; border-color: var(--accent); }
.sd-item .sd-amount { display: flex; align-items: center; font-size: .9rem; color: var(--sand); padding: .55rem .2rem; }
.sd-item .sd-del {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: var(--radius); cursor: pointer; height: 34px; font-size: 1rem; line-height: 1;
  transition: color .25s, border-color .25s;
}
.sd-item .sd-del:hover { color: var(--clay); border-color: var(--clay); }
@media (max-width: 560px) {
  .sd-items { display: none; }
  .sd-item { grid-template-columns: 1fr 1fr; gap: .5rem; padding: .8rem; border: 1px solid var(--line); border-radius: var(--radius); }
  .sd-item input[data-f="desc"] { grid-column: 1 / -1; }
  .sd-item .sd-amount { grid-column: 1 / -1; }
}
.sd-add {
  font-family: var(--label); font-size: .8rem; color: var(--accent);
  background: transparent; border: 1px dashed var(--stone-2); border-radius: var(--radius);
  padding: .6rem 1rem; cursor: pointer; margin-top: .3rem; transition: background .25s, color .25s;
}
.sd-add:hover { background: var(--ink-3); }

/* ---------- Actions ---------- */
.sd-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.sd-ghost { opacity: .8; }
.sd-note { margin-top: 1rem; font-size: .9rem; color: var(--accent); min-height: 1.2em; }
.sd-sm { padding: .5rem .95rem; font-size: .78rem; }

/* ---------- Summary ---------- */
.sd-sumrow { display: flex; justify-content: space-between; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); font-family: var(--sans); }
.sd-sumrow span { color: var(--muted); font-size: .9rem; }
.sd-sumrow b { font-size: 1rem; color: var(--fg); font-weight: 500; }
.sd-sumrow--total { border-bottom: none; margin-top: .4rem; padding-top: 1rem; border-top: 1px solid var(--accent); }
.sd-sumrow--total span { color: var(--fg); font-family: var(--display); font-size: 1.1rem; }
.sd-sumrow--total b { color: var(--accent); font-size: 1.5rem; font-family: var(--display); }
.sd-words { margin-top: 1rem; font-size: .82rem; color: var(--stone); font-style: italic; line-height: 1.5; }
.sd-hint { margin-top: 1.4rem; font-size: .78rem; color: var(--stone-2); line-height: 1.6; }

/* ---------- Records / enquiries tables ---------- */
.sd-tablewrap { overflow-x: auto; }
.sd-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .9rem; }
.sd-table th {
  font-family: var(--label); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: .8rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.sd-table td { padding: .85rem .9rem; border-bottom: 1px solid var(--line-soft); color: var(--fg); vertical-align: top; }
.sd-table tbody tr:hover, .sd-table tbody tr:hover { background: rgba(245,241,233,0.02); }
.sd-empty { color: var(--stone-2); text-align: center; padding: 2.4rem !important; }
.sd-exports { display: flex; gap: .6rem; }
.sd-rowbtn { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius); padding: .35rem .7rem; font-size: .75rem; cursor: pointer; margin-right: .35rem; transition: color .25s, border-color .25s; }
.sd-rowbtn:hover { color: var(--accent); border-color: var(--accent); }
.sd-rowbtn.is-del:hover { color: var(--clay); border-color: var(--clay); }

/* print helper (should never show, PDF is generated off-DOM) */
@media print { .sd-app, .header, .menu, .sd-gate { display: none !important; } }
