/* Make It So — admin area. Brand colours and fonts from the public site, in a calm light layout. */
:root {
  --ink: #07103a; --muted: #6b7394; --line: #e2e6fa; --bg: #f4f6ff; --card: #fff; --nav: #0a0f2a;
  --blue: #0b3bff; --orange: #ff6a1f; --mint: #36f1b6; --gold: #ffb800; --lav: #b9a4ff; --pink: #ff5fa8; --cyan: #4de4ff;
  --danger: #c0174f; --radius: 18px;
  --font-display: 'Outfit', system-ui, sans-serif; --font-body: 'DM Sans', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.03em; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.boot { padding: 40px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px; border: 0; border-radius: 99px; background: #fff; color: var(--ink); font: 700 14px var(--font-display); cursor: pointer; text-decoration: none; box-shadow: inset 0 0 0 2px var(--line); transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-1px); background: #f8f9ff; }
.btn.primary { background: var(--orange); box-shadow: none; }
.btn.primary:hover { background: #ff8546; }
.btn.dark { background: var(--nav); color: #fff; box-shadow: none; }
.btn.danger { color: var(--danger); box-shadow: inset 0 0 0 2px #f5c4d6; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.icon-btn { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--line); }

/* auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 85% 0%, rgba(181, 139, 255, .55), transparent 55%), linear-gradient(160deg, #1a4dff, #0b3bff 45%, #0726c9); }
.auth-card { width: min(440px, 100%); background: #fff; border-radius: 28px; padding: 34px; box-shadow: 0 40px 70px -30px rgba(3, 12, 90, .6); display: grid; gap: 16px; }
.auth-card h1 { font-size: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 22px var(--font-display); letter-spacing: -.05em; }
.brand em { font-style: normal; color: var(--orange); }
.brand .mark { width: 32px; height: 32px; border-radius: 10px; background: var(--blue); display: grid; place-items: center; }
.brand .tag { font: 700 11px var(--font-display); letter-spacing: .14em; background: var(--line); border-radius: 99px; padding: 4px 9px; }
.auth-card form { display: grid; gap: 14px; }
.qr { display: grid; justify-items: center; gap: 8px; padding: 14px; background: var(--bg); border-radius: 16px; }
.qr img { width: 180px; height: 180px; image-rendering: pixelated; border-radius: 10px; background: #fff; }
.secret { font: 700 13px "Courier New", monospace; letter-spacing: .12em; word-break: break-all; text-align: center; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; background: var(--bg); border-radius: 14px; font: 700 14px "Courier New", monospace; }
.notice { padding: 12px 14px; border-radius: 12px; background: #fff6d6; color: #6b4e00; font-size: 14px; }

/* forms */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.field > span { color: var(--ink); }
.field small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 13px; border: 2px solid var(--line); border-radius: 12px; background: #f9faff; outline: none; font-weight: 400; }
textarea { resize: vertical; min-height: 92px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(11, 59, 255, .12); }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--blue); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.form-error { min-height: 1.3em; color: var(--danger); font-size: 14px; font-weight: 500; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; padding: 0 10px 22px; white-space: nowrap; }
.sidebar .brand .tag { display: none; }
.brand .word { white-space: nowrap; }
.status-list li { display: grid; grid-template-columns: 118px 1fr 28px; gap: 12px; }
.status-list li strong { text-align: right; }
.nav-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 12px; color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-link[aria-current="page"] { background: var(--blue); color: #fff; font-weight: 700; }
.badge { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--orange); color: var(--ink); font: 800 12px var(--font-display); text-align: center; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; }
.side-foot .btn { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.side-foot .btn:hover { background: rgba(255, 255, 255, .18); }
main { padding: 32px clamp(18px, 4vw, 48px) 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.page-head h1 { font-size: 34px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back { font-size: 14px; text-decoration: none; font-weight: 700; }

/* cards + grids */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 0 var(--line); }
.card > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card h2 { font-size: 18px; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.kpi { display: grid; gap: 4px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { font: 800 34px var(--font-display); letter-spacing: -.04em; }
.stack { display: grid; gap: 16px; }
.details { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }

/* toolbar + tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"] { max-width: 300px; }
.toolbar select { width: auto; }
.table-wrap { background: #fff; border-radius: var(--radius); overflow-x: auto; box-shadow: 0 1px 0 var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th { text-align: left; font: 700 12px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 18px; background: #fafbff; }
td { padding: 14px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: #f8f9ff; }
td .sub { display: block; color: var(--muted); font-size: 13px; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }

/* chips, progress */
.chip { display: inline-block; padding: 3px 11px; border-radius: 99px; font: 700 12px var(--font-display); white-space: nowrap; background: var(--line); color: var(--ink); }
.s-active, .s-launched, .s-done, .s-converted, .s-qualified { background: #cffbe9; color: #0b7a55; }
.s-prospect, .s-discovery, .s-new { background: #dbe4ff; color: #1b3bb3; }
.s-wireframing, .s-doing, .s-contacted { background: #e6e0ff; color: #4a3db8; }
.s-development { background: #ffe3d1; color: #b8410b; }
.s-review { background: #fff0c2; color: #8a6100; }
.s-accepted, .s-paid, .s-resolved { background: #cffbe9; color: #0b7a55; }
.s-issued, .s-in_progress, .s-waiting_client, .s-high { background: #fff0c2; color: #8a6100; }
.s-overdue, .s-urgent, .s-void, .s-closed { background: #ffe1e8; color: #9e1f42; }
.s-inactive, .s-on_hold, .s-todo, .s-lost { background: #ececf5; color: #555b7a; }
.s-in_review, .s-normal { background: #e6e0ff; color: #4a3db8; }
.s-blocked { background: #ffe1e8; color: #9e1f42; }
progress { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: var(--line); accent-color: var(--orange); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--orange), var(--lav)); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--orange); border-radius: 99px; }
.prog { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; min-width: 130px; font-size: 13px; color: var(--muted); }

/* lists inside cards */
.list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .sub { display: block; color: var(--muted); font-size: 13px; }
.row-actions { display: flex; gap: 6px; }
.milestone.done .title { text-decoration: line-through; color: var(--muted); }
.milestone button.state { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: #fff; cursor: pointer; flex: none; font-size: 13px; line-height: 1; }
.milestone.doing button.state { border-color: var(--lav); background: #e6e0ff; }
.milestone.done button.state { border-color: var(--mint); background: var(--mint); }
.note { padding: 12px 0; border-top: 1px solid var(--line); }
.note:first-of-type { border-top: 0; }
.note p { white-space: pre-wrap; }
.note .meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.note.pinned { background: #fffbea; margin: 0 -10px; padding: 12px 10px; border-radius: 10px; }
.note-form { display: grid; gap: 8px; margin-bottom: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab { border: 0; background: #fff; border-radius: 99px; padding: 8px 16px; font: 700 13px var(--font-display); cursor: pointer; box-shadow: inset 0 0 0 2px var(--line); }
.tab[aria-pressed="true"] { background: var(--nav); color: #fff; box-shadow: none; }
.lead { display: grid; gap: 10px; }
.lead .msg { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.lead-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: baseline; }
.work-board { display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; padding-bottom: 8px; }
.work-column { min-width: 190px; padding: 12px; border-radius: 16px; background: #e9ecf8; }
.work-column > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 10px; }
.work-column h2 { font-size: 15px; }
.work-card { display: grid; gap: 8px; padding: 12px; margin-top: 8px; border-radius: 12px; background: #fff; box-shadow: 0 1px 0 var(--line); }
.work-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.work-card .sub { color: var(--muted); font-size: 12px; text-decoration: none; }
.work-card a.sub:hover { color: var(--blue); }
.work-card .row-actions { flex-wrap: wrap; }
.work-visible { width: fit-content; padding: 2px 7px; border-radius: 99px; background: #cffbe9; color: #0b7a55; font-size: 11px; }
.work-empty { padding: 10px 0; color: var(--muted); font-size: 13px; }
.work-row { align-items: flex-start !important; }
.work-thread { display: grid; gap: 8px; }
.work-message { padding: 10px 12px; border-radius: 10px; background: #edf0fa; overflow-wrap: anywhere; }
.work-message.from-client { background: #fff0e4; }
.work-message p { white-space: pre-wrap; }
.work-message small { display: block; margin-top: 5px; color: var(--muted); }
.project-reply-form { display: grid; gap: 8px; }
.project-reply-form textarea { width: 100%; min-height: 72px; }
.project-reply-form .form-error:empty { display: none; }
.work-progress-note { margin: -4px 0 12px; font-size: 13px; }
#timesheet-table td { min-width: 100px; }
#timesheet-table td:nth-child(3) { min-width: 210px; }
#timesheet-table td:last-child { min-width: 150px; }

/* modal + toast */
dialog { border: 0; border-radius: 24px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 40px 90px -20px rgba(3, 12, 90, .55); }
dialog::backdrop { background: rgba(5, 8, 23, .6); }
.modal-form { display: grid; gap: 14px; padding: 24px; max-height: calc(100vh - 40px); overflow: auto; }
.modal-form header { display: flex; justify-content: space-between; align-items: center; }
.modal-form h2 { font-size: 22px; }
.modal-form footer { display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.quote-modal { width: min(760px, calc(100vw - 24px)); }
.line-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.quote-line { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(95px, 1fr)) auto; gap: 10px; align-items: end; padding: 12px 0; border-top: 1px solid var(--line); }
.quote-line .field { min-width: 0; }
.quote-totals { justify-content: end; max-width: 360px; margin: 18px 0 0 auto; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--nav); color: #fff; padding: 12px 20px; border-radius: 99px; font-weight: 700; transition: opacity .25s, transform .25s; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px; gap: 4px; }
  .sidebar .brand { padding: 0 10px 0 4px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; }
  .side-foot .muted { display: none; }
  .nav-link { padding: 8px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr; gap: 0; }
  .details dd { margin-bottom: 10px; }
  .quote-line { grid-template-columns: 1fr 1fr; }
  .quote-line .field:first-child { grid-column: 1 / -1; }
  .work-board { grid-template-columns: repeat(5, minmax(210px, 1fr)); }
  .toolbar > .field { min-width: 180px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
