/* Ninyis · Orders: the team's CRM (plans/crm-plan.md). Light and dark, like Ninyis's dashboard. */
:root {
  --bg: #f4f4f6; --surface: #ffffff; --surface-2: #f0f0f3; --surface-3: #e8e8ec; --border: #e1e1e7; --text: #18191f; --muted: #6a6c78;
  --accent: #18191f; --accent-text: #ffffff; --link: #4f46e5; --good: #15803d; --bad: #c0262d; --warn: #a15c00;
  --basic: #2563eb; --standard: #058a5b; --premium: #b45f06; --custom: #7c3aed;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 1px 1px rgba(20, 20, 30, .04);
  --radius: 10px; color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0e0f13; --surface: #16171d; --surface-2: #1d1f27; --surface-3: #262833; --border: #2a2c38; --text: #e8e9ef; --muted: #9597a8;
  --accent: #e8e9ef; --accent-text: #111217; --link: #a5b4fc; --good: #4ade80; --bad: #f87171; --warn: #fbbf24;
  --basic: #60a5fa; --standard: #34d399; --premium: #fbbf24; --custom: #a78bfa;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f13; --surface: #16171d; --surface-2: #1d1f27; --surface-3: #262833; --border: #2a2c38; --text: #e8e9ef; --muted: #9597a8;
    --accent: #e8e9ef; --accent-text: #111217; --link: #a5b4fc; --good: #4ade80; --bad: #f87171; --warn: #fbbf24;
    --basic: #60a5fa; --standard: #34d399; --premium: #fbbf24; --custom: #a78bfa;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 12px; white-space: nowrap; }
button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 35%, var(--border)); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.small { padding: 3px 9px; font-size: 12.5px; border-radius: 7px; }
button.quiet { border-color: transparent; background: none; color: var(--muted); }
button.quiet:hover:not(:disabled) { color: var(--text); background: var(--surface-2); border-color: transparent; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--link) 55%, transparent); outline-offset: 1px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ── The top bar ─────────────────────────────── */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; height: 54px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; }
.brand small { font-weight: 500; color: var(--muted); }
.nav { display: flex; gap: 2px; }
.nav a { padding: 6px 11px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--text); background: var(--surface-2); }
.who { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.who strong { color: var(--text); font-weight: 600; }
main { padding: 18px 20px 40px; }

/* ── Sign-in ─────────────────────────────── */
.sign-in { max-width: 360px; margin: 14vh auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.sign-in h1 { margin: 12px 0 2px; font-size: 20px; letter-spacing: -.01em; }
.sign-in p { margin: 0 0 18px; }
.sign-in label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.sign-in input { width: 100%; padding: 9px 11px; }
.sign-in button { width: 100%; margin-top: 20px; padding: 9px; }
.sign-in .error { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 1em; }

/* ── Chips: status, package, person ─────────────────────────────── */
.status { --c: #8a8d99; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 72%, var(--text)); }
.c-green { --c: #2e9e5b; } .c-red { --c: #e0364a; } .c-blue-green { --c: #17a68f; } .c-yellow { --c: #d9a400; }
.c-blue { --c: #3b74e0; } .c-aqua { --c: #1d9bd1; } .c-cool-gray { --c: #6f858a; } .c-none { --c: #8a8d99; }
/* The order's status: one menu in its own colour. */
select.status-select { --c: #8a8d99; font-weight: 600; background-color: color-mix(in srgb, var(--c) 15%, var(--surface));
  color: color-mix(in srgb, var(--c) 72%, var(--text)); border-color: color-mix(in srgb, var(--c) 40%, var(--border)); }
select.status-select option { background: var(--surface); color: var(--text); }
.pkg { --c: var(--muted); display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 11%, transparent); color: var(--c); }
.pkg.basic { --c: var(--basic); } .pkg.standard { --c: var(--standard); } .pkg.premium { --c: var(--premium); } .pkg.custom { --c: var(--custom); }
.avatar { --hue: 220; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 10.5px; font-weight: 700; color: #fff; flex: none;
  background: hsl(var(--hue) 55% 48%); border: 2px solid var(--surface); }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -7px; }
.person { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.person .avatar { width: 22px; height: 22px; border: none; }
.person button { border: none; background: none; padding: 0 4px; color: var(--muted); font-size: 15px; line-height: 1; }
.person button:hover { color: var(--bad); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--link); color: #fff; }
.count { color: var(--muted); font-size: 12px; font-weight: 500; }

/* ── The board ─────────────────────────────── */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type="search"] { width: 240px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; min-height: calc(100vh - 150px); }
.column { background: var(--surface-2); border-radius: 12px; padding: 8px; min-height: 120px; transition: background .12s, box-shadow .12s; }
.column.drop { background: color-mix(in srgb, var(--link) 10%, var(--surface-2)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--link) 45%, transparent); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 650; font-size: 13.5px; }
.column-head .count { margin-left: auto; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card { display: block; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 11px; box-shadow: var(--shadow); cursor: pointer; }
.card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--text) 28%, var(--border)); }
.card.dragging { opacity: .45; }
.card-top { display: flex; align-items: center; gap: 6px; }
.card-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.card-client { font-weight: 650; margin: 3px 0 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-account { color: var(--muted); font-size: 12.5px; }
.card-mid { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.card-price { margin-left: auto; font-weight: 600; font-size: 13px; }
.card-bottom { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.card-bottom .avatars { margin-left: auto; }
.due.late { color: var(--bad); font-weight: 600; }
.due.soon { color: var(--warn); font-weight: 600; }
.files-count { display: inline-flex; align-items: center; gap: 3px; }
.more { width: 100%; margin-top: 8px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 8px; }

/* ── An order ─────────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.order-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.order-head h1 { margin: 0; font-size: 22px; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-head .sub { color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.order-head .controls { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 8px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.long { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; max-height: 340px; overflow: auto; }
.long.open { max-height: none; }
.people-list { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Uploading */
.drop-zone { border: 1.5px dashed color-mix(in srgb, var(--muted) 55%, transparent); border-radius: 12px; padding: 18px; text-align: center; transition: background .12s, border-color .12s; }
.drop-zone.over { border-color: var(--link); background: color-mix(in srgb, var(--link) 7%, transparent); }
.drop-zone .big { font-weight: 600; margin-bottom: 4px; }
.picked { margin-top: 12px; text-align: left; }
.picked-list { max-height: 180px; overflow: auto; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; margin: 8px 0; }
.picked-list div { display: flex; gap: 8px; padding: 2px 10px; }
.picked-list div span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-input { width: 100%; }

/* The timeline */
.timeline { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.upload { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.upload-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.upload-head .avatar { width: 30px; height: 30px; font-size: 12px; border: none; }
.upload-head .when { color: var(--muted); font-size: 12.5px; }
.upload-head .actions { margin-left: auto; display: flex; gap: 6px; }
.upload-note { padding: 0 14px 10px 54px; margin-top: -4px; }
.file-list { border-top: 1px solid var(--border); }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 14px; font-size: 13.5px; }
.file + .file { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.file .thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); flex: none; }
.file .icon { width: 40px; height: 40px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--muted); flex: none; text-transform: uppercase; }
.file .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .name .folder { color: var(--muted); }
.file .size { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.file .file-actions { display: flex; gap: 4px; opacity: .85; }
.file.pending { color: var(--muted); }
.bar { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; min-width: 80px; flex: 0 0 120px; }
.bar i { display: block; height: 100%; background: var(--link); width: 0; transition: width .2s; }
.bar.failed i { background: var(--bad); }
.event { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; padding: 0 6px; }
.event::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex: none; margin: 0 6px 0 10px; }

/* The uploads in progress, on every page */
.tray { position: fixed; right: 16px; bottom: 16px; width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .16); z-index: 30; overflow: hidden; }
.tray-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; font-size: 13.5px; }
.tray-body { max-height: 240px; overflow: auto; border-top: 1px solid var(--border); padding: 6px 0; }
.tray-file { display: flex; align-items: center; gap: 8px; padding: 4px 12px; font-size: 12.5px; }
.tray-file .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-file .bar { flex-basis: 70px; min-width: 70px; }

/* ── People and trash ─────────────────────────────── */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
table { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tr.off td { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; user-select: all; overflow-wrap: anywhere; color: var(--text); }

/* ── Dialogs and toasts ─────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(10, 10, 15, .45); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal .panel { width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 9px; z-index: 50; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 960px) {
  .order-grid { grid-template-columns: 1fr; }
  .order-side { order: -1; }
}
@media (max-width: 640px) {
  .top { gap: 10px; padding: 0 12px; }
  .brand small, .who .role { display: none; }
  main { padding: 14px 12px 40px; }
  .filters input[type="search"] { width: 100%; }
  .board { grid-auto-columns: 86vw; }
  .tray { left: 12px; right: 12px; width: auto; }
}
