/* QyloDev Client Portal */
:root {
  --navy: #0B1F3A;
  --navy-2: #12294A;
  --navy-3: #1B3A63;
  --cyan: #00B4D8;
  --cyan-soft: #E2F7FB;
  --cyan-ink: #00718A;
  --bg: #F2F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #DFE5EE;
  --ink: #0B1F3A;
  --muted: #4C5D75;
  --ok: #0F7A55;
  --ok-soft: #E3F5EC;
  --warn: #9A5300;
  --warn-soft: #FFF2DD;
  --bad: #B42318;
  --bad-soft: #FDE8E6;
  --info: #1D4ED8;
  --info-soft: #E6EEFF;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11, 31, 58, .06), 0 8px 24px -12px rgba(11, 31, 58, .18);
  --head: "Space Grotesk", Inter, system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan-ink); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Boot */
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 12px; white-space: nowrap;
  background: var(--navy); border: 1px solid rgba(0, 180, 216, .4);
  font-family: var(--head); font-weight: 700; font-size: 20px; color: #fff; letter-spacing: -.5px;
}
.mark span { color: var(--cyan); }
.boot .mark { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }

.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.logo .word { font-family: var(--head); font-weight: 700; font-size: 21px; letter-spacing: -.3px; }
.logo .word span { color: var(--cyan); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; padding: 44px 56px;
  background:
    radial-gradient(600px 400px at 85% 10%, rgba(0, 180, 216, .22), transparent 60%),
    radial-gradient(500px 360px at 0% 100%, rgba(0, 180, 216, .12), transparent 60%),
    linear-gradient(160deg, #0B1F3A 0%, #0E2747 100%);
  display: flex; flex-direction: column;
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 85%);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-copy { margin: auto 0; max-width: 470px; padding: 48px 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #BFEFF8;
  border: 1px solid rgba(0, 180, 216, .35); background: rgba(0, 180, 216, .08); padding: 6px 12px; border-radius: 999px;
}
.auth-copy h1 { font-size: clamp(34px, 3.6vw, 48px); margin: 22px 0 16px; font-weight: 700; }
.auth-copy h1 em { font-style: normal; color: var(--cyan); }
.auth-copy p { color: #C8D4E5; font-size: 18px; margin: 0 0 28px; }
.perks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.perks li { display: flex; gap: 14px; align-items: flex-start; color: #E7EEF7; }
.perks .ic { flex: none; width: 36px; height: 36px; border-radius: 10px; background: rgba(0, 180, 216, .14); color: var(--cyan); display: grid; place-items: center; }
.perks strong { display: block; color: #fff; font-weight: 600; }
.perks small { color: #A9B8CC; font-size: 15px; }
.auth-foot { color: #93A6BF; font-size: 14px; }
.auth-foot a { color: #BFEFF8; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 460px; }
.auth-card h2 { font-size: 32px; margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin: 0 0 28px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #E4EAF2; padding: 5px; border-radius: 14px; margin-bottom: 28px; }
.tabs button { border: 0; background: transparent; padding: 11px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(11,31,58,.12); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label, .label { font-weight: 600; font-size: 15px; }
.field .hint { color: var(--muted); font-size: 14px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px; padding: 12px 16px; border: 1.5px solid #CBD5E1; border-radius: 12px; background: #fff;
  font-size: 17px; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 140px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(0, 180, 216, .18); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 15px; margin: 4px 0 20px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--cyan); flex: none; }
.pw { position: relative; }
.pw .input { padding-right: 76px; }
.pw button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--cyan-ink); font-weight: 600; font-size: 15px; padding: 8px 10px; cursor: pointer; border-radius: 8px; }
.hp { position: absolute; left: -9999px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 12px 22px;
  border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none;
  transition: transform .06s, background .15s, box-shadow .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cyan); color: var(--navy); box-shadow: 0 8px 20px -10px rgba(0, 180, 216, .9); }
.btn-primary:hover { background: #12C3E6; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-3); }
.btn-ghost { background: #fff; border-color: #CBD5E1; color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: #fff; border-color: #F1B8B2; color: var(--bad); }
.btn-wa { background: #25D366; color: #06371A; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 15px; border-radius: 10px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { border: 0; background: none; padding: 0; color: var(--cyan-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.alert { border-radius: 12px; padding: 13px 16px; margin-bottom: 18px; font-size: 15px; display: flex; gap: 10px; }
.alert-bad { background: var(--bad-soft); color: #7A1A12; }
.alert-ok { background: var(--ok-soft); color: #0B5139; }
.alert-info { background: var(--cyan-soft); color: #075365; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--navy); color: #C9D5E6; display: flex; flex-direction: column;
  padding: 24px 16px 18px; border-right: 1px solid rgba(255,255,255,.04);
}
.side .logo { padding: 0 10px 26px; }
.side-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: #7F93AF; padding: 16px 12px 8px; font-weight: 600; }
.nav { display: grid; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 13px; padding: 12px 13px; border-radius: 12px; color: #D3DDEA; text-decoration: none; font-weight: 500;
  position: relative;
}
.nav a svg { flex: none; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(0, 180, 216, .14); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cyan); }
.nav a[aria-current="page"] svg { color: var(--cyan); opacity: 1; }
.nav .count { margin-left: auto; background: var(--cyan); color: var(--navy); font-size: 13px; font-weight: 700; border-radius: 999px; padding: 1px 9px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; }
.me { display: flex; gap: 12px; align-items: center; padding: 6px 8px 12px; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-family: var(--head); background: var(--navy-3); color: #fff; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; background: var(--navy); }
.me strong { display: block; color: #fff; font-size: 15px; line-height: 1.3; }
.me small { color: #93A6BF; font-size: 13px; }
.side-actions { display: grid; gap: 6px; }
.side-actions a, .side-actions button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #C9D5E6; background: transparent; border: 0;
  text-decoration: none; font-size: 15px; cursor: pointer; text-align: left;
}
.side-actions a:hover, .side-actions button:hover { background: rgba(255,255,255,.06); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
#view:focus { outline: none; }
.topbar { display: none; }
.page { padding: 34px clamp(18px, 3.4vw, 48px) 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(26px, 2.6vw, 34px); }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 20px; }
.card-head a { font-weight: 600; font-size: 15px; text-decoration: none; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

.hero {
  border-radius: 20px; padding: 30px 32px; color: #fff; margin-bottom: 22px; position: relative; overflow: hidden;
  background: radial-gradient(520px 260px at 92% 0%, rgba(0,180,216,.30), transparent 60%), linear-gradient(135deg, #0B1F3A, #143259);
  display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap;
}
.hero h1 { font-size: clamp(26px, 2.6vw, 34px); }
.hero p { color: #C8D4E5; margin: 8px 0 0; max-width: 560px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.25); }
.hero .btn-ghost:hover { border-color: #fff; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { padding: 20px 22px; }
.stat .k { color: var(--muted); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .k svg { color: var(--cyan-ink); }
.stat .v { font-family: var(--head); font-size: 32px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat .s { color: var(--muted); font-size: 14px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 16px 24px;
  text-decoration: none; color: inherit;
}
a.item:hover { background: var(--surface-2); }
.item .t { font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 0; }
.item .t span.subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { color: var(--muted); font-size: 14px; grid-column: 1; }
.item .r { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); flex: none; }
.num { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.me small { overflow-wrap: anywhere; }
.grid-2, .grid-side { align-items: start; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.p-open { background: var(--info-soft); color: var(--info); }
.p-in_progress { background: var(--cyan-soft); color: var(--cyan-ink); }
.p-awaiting_client { background: var(--warn-soft); color: var(--warn); }
.p-resolved, .p-paid, .p-active { background: var(--ok-soft); color: var(--ok); }
.p-unpaid { background: var(--warn-soft); color: var(--warn); }
.p-overdue, .p-urgent { background: var(--bad-soft); color: var(--bad); }
.p-cancelled, .p-ended, .p-paused, .p-low, .p-normal { background: #EDF1F6; color: var(--muted); }
.p-high { background: var(--warn-soft); color: var(--warn); }

.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--cyan-soft); color: var(--cyan-ink); display: grid; place-items: center; margin: 0 auto 14px; }
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; font-family: var(--head); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 15px; cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.search { margin-left: auto; min-width: 220px; flex: 1; max-width: 340px; }
.search .input { min-height: 44px; padding: 9px 14px; font-size: 16px; }

/* Ticket thread */
.thread { display: grid; gap: 18px; padding: 24px; }
.msg { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
.msg .avatar { width: 44px; height: 44px; font-size: 16px; }
.msg.staff .avatar { background: var(--navy); color: var(--cyan); }
.msg.client .avatar { background: #E7EDF5; color: var(--navy); }
.bubble { border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 14px 18px; background: #fff; }
.msg.staff .bubble { background: #F2FBFD; border-color: #BDEBF4; }
.msg.internal .bubble { background: #FFF8EC; border-color: #F3D9A9; border-style: dashed; }
.bubble .who { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.bubble .who strong { font-size: 16px; }
.bubble .who small { color: var(--muted); font-size: 14px; }
.bubble .tag { font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--navy); color: #fff; }
.bubble .tag.note { background: #F3D9A9; color: #5A3A00; }
.bubble .body { white-space: pre-wrap; word-wrap: break-word; }
.files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); max-width: 100%; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; padding-left: 58px; }
.event::before { content: ""; height: 1px; width: 24px; background: var(--line); }

.composer { border-top: 1px solid var(--line); padding: 20px 24px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.composer textarea.input { min-height: 120px; background: #fff; }
.composer-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.composer-bar .spacer { flex: 1; }
.attach { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--cyan-ink); font-weight: 600; font-size: 15px; padding: 8px 10px; border-radius: 10px; }
.attach:hover { background: #fff; }
.attach input { display: none; }
.picked { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.picked .file button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 4px; font-size: 16px; }

.dl { display: grid; gap: 0; margin: 0; }
.dl div { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.dl div:last-child { border-bottom: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }

/* Category picker */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cat { position: relative; }
.cat input { position: absolute; opacity: 0; }
.cat label {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: #fff;
  font-weight: 600; font-size: 15.5px; height: 100%;
}
.cat label svg { color: var(--cyan-ink); }
.cat input:checked + label { border-color: var(--cyan); background: var(--cyan-soft); box-shadow: 0 0 0 3px rgba(0,180,216,.15); }
.cat input:focus-visible + label { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* Service cards */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.svc { padding: 20px 22px; display: grid; gap: 10px; }
.svc .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--cyan-soft); color: var(--cyan-ink); }
.svc h3 { font-size: 18px; }
.svc p { margin: 0; color: var(--muted); font-size: 15px; }
.svc .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }

.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.offer { padding: 20px; display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer; border: 1.5px solid var(--line); background: #fff; border-radius: 16px; }
.offer:hover { border-color: var(--cyan); box-shadow: var(--shadow); }
.offer .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--navy); color: var(--cyan); display: grid; place-items: center; }
.offer strong { font-family: var(--head); font-size: 18px; }
.offer span { color: var(--muted); font-size: 15px; }

/* Invoice document */
.invoice-doc { padding: 40px; }
.inv-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 26px; border-bottom: 2px solid var(--navy); }
.inv-top .logo { color: var(--navy); }
.inv-top .logo .mark { width: 40px; height: 40px; font-size: 18px; }
.inv-top h2 { font-size: 34px; text-align: right; }
.inv-meta { text-align: right; color: var(--muted); font-size: 15px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0; }
.inv-parties h4 { font-family: var(--body); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.inv-table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 10px; border-bottom: 1px solid var(--line); }
.inv-table td { padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.inv-table .n { text-align: right; white-space: nowrap; }
.inv-total { display: flex; justify-content: flex-end; padding: 18px 10px; }
.inv-total div { min-width: 260px; display: flex; justify-content: space-between; font-family: var(--head); font-size: 24px; font-weight: 700; border-top: 2px solid var(--navy); padding-top: 12px; }
.inv-notes { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font-size: 15px; color: var(--muted); }
.inv-notes pre { font-family: inherit; white-space: pre-wrap; margin: 0; color: var(--ink); }
.paid-stamp { display: inline-block; border: 3px solid var(--ok); color: var(--ok); font-family: var(--head); font-weight: 700; font-size: 22px; padding: 4px 14px; border-radius: 10px; transform: rotate(-6deg); }

.items-edit { display: grid; gap: 10px; }
.items-edit .it { display: grid; grid-template-columns: minmax(0, 1fr) 90px 140px 44px; gap: 10px; align-items: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { border-color: var(--bad); color: var(--bad); }

/* Tables (staff) */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 24px; border-bottom: 1px solid var(--line); font-weight: 600; background: var(--surface-2); }
.table td { padding: 15px 24px; border-bottom: 1px solid var(--line); font-size: 15.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.who-cell strong { display: block; }
.who-cell small { color: var(--muted); }

.bars { display: grid; gap: 12px; padding: 22px 24px; }
.bar { display: grid; grid-template-columns: 170px minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 15px; }
.bar .track { height: 12px; background: #EDF1F6; border-radius: 999px; overflow: hidden; }
.bar .track { display: block; }
.bar .fill { display: block; height: 100%; background: var(--cyan); border-radius: 999px; }
.bar b { text-align: right; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(11, 31, 58, .55); display: grid; place-items: center; padding: 18px; z-index: 50; animation: fade .15s; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 620px; max-height: calc(100vh - 36px); overflow: auto; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.modal .card-head { position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-body { padding: 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 24px; }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 14px 20px; border-radius: 12px; font-weight: 600; z-index: 60; box-shadow: 0 16px 40px -12px rgba(0,0,0,.4); display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px); }
.toast svg { color: var(--cyan); flex: none; }

.help-card { background: var(--navy); color: #C9D5E6; border-radius: var(--radius); padding: 22px; }
.help-card h3 { color: #fff; font-size: 19px; margin-bottom: 6px; }
.help-card p { margin: 0 0 16px; font-size: 15px; }
.help-card .btns { display: grid; gap: 8px; }
.help-card .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }

.muted { color: var(--muted); }
.mt { margin-top: 20px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.skeleton { background: linear-gradient(90deg, #E9EEF5 25%, #F4F7FB 50%, #E9EEF5 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 26px 22px; }
  .auth-copy { padding: 26px 0 6px; }
  .auth-copy h1 { font-size: 30px; margin-top: 16px; }
  .auth-copy p { font-size: 16px; margin-bottom: 18px; }
  .perks, .auth-foot { display: none; }
  .auth-main { padding: 28px 18px 44px; align-items: flex-start; }

  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 290px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.35); }
  .scrim { position: fixed; inset: 0; background: rgba(11,31,58,.5); z-index: 39; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--navy); }
  .topbar .logo .word { font-size: 19px; }
  .menu-btn { border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
  .page { padding: 22px 16px 48px; }
  .hero { padding: 22px; }
  .row2, .row3 { grid-template-columns: 1fr; gap: 0; }
  .item { padding: 15px 18px; }
  .card-head, .toolbar { padding-left: 18px; padding-right: 18px; }
  .thread { padding: 18px; }
  .composer { padding: 16px 18px; }
  .search { max-width: none; min-width: 100%; margin-left: 0; }
  .table-wrap { overflow-x: auto; }
  .table th, .table td { padding: 12px 16px; }
  .invoice-doc { padding: 22px; }
  .inv-parties, .inv-notes { grid-template-columns: 1fr; }
  .items-edit .it { grid-template-columns: minmax(0, 1fr) 70px 110px 44px; }
  .bar { grid-template-columns: 120px minmax(0, 1fr) 30px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .stat .v { font-size: 26px; }
  .event { padding-left: 0; }
  .msg { grid-template-columns: 1fr; }
  .msg .avatar { display: none; }
  .items-edit .it { grid-template-columns: 1fr 1fr; }
  .items-edit .it > :first-child { grid-column: 1 / -1; }
  .page-head .btn { width: 100%; }
}

/* ---------- Print (invoices) ---------- */
@media print {
  body { background: #fff; font-size: 14px; }
  .side, .topbar, .no-print, .scrim { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .invoice-doc { padding: 0; }
}

/* Client levels */
.tier { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; vertical-align: middle; font-family: var(--body); }
.tier::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.tier-platinum { background: linear-gradient(135deg, #1D2A3D, #3B4B63); color: #E8EEF7; }
.tier-platinum::before { background: linear-gradient(135deg, #F4F7FB, #A9B6C8); }
.tier-gold { background: #FFF4D6; color: #7A5300; }
.tier-gold::before { background: linear-gradient(135deg, #FFD978, #C98F0A); }
.tier-silver { background: #EEF1F5; color: #475569; }
.tier-silver::before { background: linear-gradient(135deg, #F1F4F8, #94A3B8); }
.tier-bronze { background: #F8E9DF; color: #7C3E14; }
.tier-bronze::before { background: linear-gradient(135deg, #E9A877, #A0522D); }
.item .m .tier { margin-left: 4px; font-size: 12px; padding: 1px 8px 1px 6px; }

/* Give back */
.give { display: flex; gap: 16px; padding: 22px; background: linear-gradient(135deg, #FFF5F7, #FFFFFF 60%); border-color: #F6D3DB; }
.give .ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #FDE3EA; color: #C2335B; }
.give h3 { font-size: 19px; margin-bottom: 6px; }
.give p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.give-hero { background: radial-gradient(520px 260px at 92% 0%, rgba(255, 120, 160, .28), transparent 60%), linear-gradient(135deg, #0B1F3A, #2A2350); }
.give-hero .eyebrow { color: #FFD3E0; border-color: rgba(255, 150, 180, .4); background: rgba(255, 150, 180, .1); }
.nav a[data-route="sponsor"] svg { color: #FF8FB0; }

/* Projects */
.pbar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pbar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan-ink), var(--cyan)); transition: width .4s ease; }
.pitem-bar { grid-column: 1 / -1; display: block; margin-top: 4px; }
.project-hero { align-items: flex-end; }
.hero-progress { margin-top: 18px; max-width: 560px; }
.hero-progress .pct { color: #C8D4E5; font-size: 15px; margin-bottom: 8px; }
.hero-progress .pct strong { color: #fff; font-family: var(--head); font-size: 26px; margin-right: 2px; }
.hero .pbar { background: rgba(255,255,255,.15); height: 12px; }
.ps-done { background: var(--ok-soft); color: var(--ok); }
.ps-active { background: var(--info-soft); color: var(--info); }
.ps-next { background: var(--warn-soft); color: var(--warn); }
.ps-planned { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.steps { list-style: none; margin: 0; padding: 4px 0 8px; }
.step { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 22px; }
.step + .step { border-top: 1px solid var(--line); }
.step strong { font-weight: 600; display: block; }
.step small { display: block; color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.step .bullet { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; margin-top: 1px; }
.step .bullet svg { width: 14px; height: 14px; }
.st-done .bullet { background: var(--ok); border-color: var(--ok); color: #fff; }
.st-active .bullet { border-color: var(--info); box-shadow: inset 0 0 0 4px var(--info-soft); background: var(--info); }
.st-next .bullet { border-color: var(--warn); }
.st-done strong { color: var(--muted); }
.todos { list-style: none; margin: 0; padding: 0; }
.todo { padding: 12px 22px; border-top: 1px solid var(--line); }
.todo label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.todo input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 2px 0 0; accent-color: var(--ok); cursor: pointer; }
.todo input[disabled] { cursor: not-allowed; opacity: .55; }
.todo .tt { font-weight: 500; }
.todo.is-done .tt { text-decoration: line-through; color: var(--muted); }
.todo .tm { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0 34px; font-size: 13.5px; }
.owner, .due { padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.o-client { background: var(--warn-soft); color: var(--warn); }
.o-qylodev { background: var(--cyan-soft); color: var(--cyan-ink); }
.due { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.due.late { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.done-list summary { padding: 12px 22px; border-top: 1px solid var(--line); cursor: pointer; color: var(--muted); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 8px 22px 18px; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--cyan); }
.timeline time { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.timeline p { margin: 2px 0 0; }
.edit-block { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 14px; background: var(--surface-2); }
.edit-row { display: grid; grid-template-columns: minmax(0, 2fr) 150px minmax(0, 2fr) 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.er-action { grid-template-columns: minmax(0, 3fr) 130px 160px auto 40px; }
.er-update { grid-template-columns: 160px minmax(0, 1fr) 40px; align-items: start; }
.er-link { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 40px; }
.edit-row .check { display: inline-flex; gap: 6px; align-items: center; font-size: 15px; white-space: nowrap; }
.sticky-save { position: sticky; bottom: 0; justify-content: flex-end; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 760px) {
  .edit-row, .er-action, .er-update, .er-link { grid-template-columns: minmax(0, 1fr) 40px; }
  .edit-row > :not(.icon-btn) { grid-column: 1; }
  .edit-row > .icon-btn { grid-column: 2; grid-row: 1; }
  .step { padding: 12px 18px; }
}
.edit-block .btns, .sticky-save { display: flex; gap: 8px; flex-wrap: wrap; }

/* Verified tick, documents, tasks */
.vbadge { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--cyan-ink); }
.vbadge svg { width: 18px; height: 18px; fill: var(--cyan-soft); }
.side .vbadge { color: var(--cyan); }
.side .vbadge svg { fill: rgba(0, 180, 216, .18); }
.attach-btn { position: relative; cursor: pointer; }
.attach-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.attach-btn:focus-within { outline: 3px solid var(--cyan); outline-offset: 2px; }
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; gap: 8px; padding: 10px 14px 10px 22px; border-top: 1px solid var(--line); }
.docs a { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.docs a:hover strong { text-decoration: underline; }
.docs a > svg { flex: none; color: var(--cyan-ink); }
.docs strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs small { display: block; color: var(--muted); font-size: 13.5px; }
.inv-sum { margin: 0; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.inv-sum strong { color: var(--ink); }
.todos a.owner { text-decoration: none; }
.todos a.owner:hover { text-decoration: underline; }

/* Meetings */
.mtgs { list-style: none; margin: 0; padding: 0; }
.mtg { padding: 18px 22px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.mtg:first-child { border-top: 0; }
.mtg-top { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mtg-top h3 { font-size: 17px; }
.mtg-when { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-weight: 600; }
.mtg-when svg { flex: none; margin-top: 2px; color: var(--cyan-ink); }
.mtg-when small { font-weight: 500; color: var(--muted); }
.mtg-where { margin: 0; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mtg-notes { margin: 0; white-space: pre-wrap; }
.mtg-answer { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 15px; }
.mtg-answer small, .mtg-hist small { color: var(--muted); }
.mtg-note { color: var(--muted); font-style: italic; white-space: pre-wrap; }
.mtg-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.mtg-hist { font-size: 14.5px; }
.mtg-hist summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.mtg-hist ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.mtg-adv { margin: 0 0 14px; }
.mtg-adv summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.mtg-cancelled .mtg-top h3, .mtg-cancelled .mtg-when { text-decoration: line-through; color: var(--muted); }
.p-mtg-proposed { background: var(--warn-soft); color: var(--warn); }
.p-mtg-accepted { background: var(--ok-soft); color: var(--ok); }
.p-mtg-declined { background: var(--bad-soft); color: var(--bad); }
.p-mtg-reschedule_requested { background: var(--info-soft); color: var(--info); }
.p-mtg-cancelled { background: #EDF1F6; color: var(--muted); }

/* ===== Responsive pass, 4 Nov 2026 =====
   Phones, tablets (portrait and landscape) and large zoom. Looks, wording and behaviour are unchanged.
   Small print is never under 14px and everything you tap is at least 44px tall. */
html body :is(.side-label, .pill, .due, .owner, .tag, th, .hint, time, h4, small) { font-size: max(14px, .82em); }
html body .side-label { font-size: 14px; }
html body .pill, html body .todo .tm, html body .todo .tm .due { font-size: 14px; }

/* touch targets */
.side-actions a, .side-actions button { min-height: 44px; }
.chip { min-height: 44px; padding-top: 9px; padding-bottom: 9px; }
.btn, .btn-sm { min-height: 44px; }
.card-head a, .crumb, .back, a.owner, .item-link { display: inline-flex; align-items: center; min-height: 44px; }
.todo label { min-height: 44px; align-items: center; }
.todo input[type=checkbox] { width: 24px; height: 24px; margin: 0; }
.check, label.check { min-height: 44px; display: inline-flex; align-items: center; }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; }
.menu-btn { min-width: 46px; min-height: 46px; }
.input, select.input { min-height: 46px; font-size: 16px; }

/* wide tables scroll inside their own box on tablets and small laptops as well, never the page */
@media (max-width: 1180px) {
  .table-wrap { overflow-x: auto; max-width: 100%; }
  .table-wrap:focus-visible { outline: 3px solid var(--cyan); outline-offset: -3px; }
  .table td, .table th { overflow-wrap: normal; }
  .grid-2, .grid-side { min-width: 0; }
}

/* the menu drawer: closed means closed for keyboards and screen readers too, and it never causes sideways scroll */
@media (max-width: 900px) {
  .side { visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .side.open { visibility: visible; transition: transform .2s ease, visibility 0s; max-width: 90vw; overflow-y: auto; }
  .shell, .main, .page { min-width: 0; max-width: 100%; }
  .topbar .logo { min-width: 0; }
  .topbar { min-height: 64px; }
  .page-head { flex-wrap: wrap; gap: 12px; }
  .toolbar .search { flex: 1 1 100%; min-width: 0; }
}

/* phones (up to 640px): tables become labelled cards instead of sideways scrolling */
@media (max-width: 640px) {
  .page { padding: 18px 12px 48px; }
  .card-head, .toolbar { padding-left: 14px; padding-right: 14px; }
  .item { padding: 14px; }
  .stat .v { font-size: 24px; }
  .btn { max-width: 100%; white-space: normal; text-align: center; }
  .table-wrap { overflow-x: visible; }
  .table, .table thead, .table tbody, .table tr, .table td, .table th { display: block; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table tbody tr { border-top: 1px solid var(--line); padding: 12px 14px; }
  .table tbody tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; overflow-wrap: anywhere; }
  .table td[data-label]:not(.who-cell)::before { content: attr(data-label); flex: 0 0 7.5rem; color: var(--muted); font-size: 14px; font-weight: 600; }
  .table td.who-cell { display: block; }
  .table td.n, .table td.right { text-align: left; }
  .items-edit .it { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) { .stats { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .invoice-doc { padding: 20px 16px; }
  .inv-table th, .inv-table td { padding: 10px 4px; }
  .inv-table th { letter-spacing: 0; }
  .inv-total div { min-width: 0; width: 100%; }
}


/* ===== Account / side-foot contrast fix (5 Nov 2026) =====
   White name on a light panel was washed out and clipped by the sticky topbar.
   Force readable ink on the account block and keep it clear of the topbar. */
.side-foot {
  background: var(--navy);
  position: relative;
  z-index: 2;
  padding-top: 16px;
  margin-top: auto;
}
.me {
  overflow: visible;
  padding: 10px 8px 12px;
  align-items: flex-start;
}
.me > div { min-width: 0; flex: 1 1 auto; }
.me strong {
  color: #F4F7FB !important;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  padding-top: 2px;
}
.me small { color: #A9BAD0 !important; }
.side-actions a, .side-actions button {
  color: #D5E0EE !important;
}
.side-actions a:hover, .side-actions button:hover {
  color: #fff !important;
}
@media (max-width: 900px) {
  .side.open {
    padding-top: 12px;
  }
  .side.open .side-foot {
    /* Keep the account block from sliding under the sticky navy topbar */
    scroll-margin-top: 72px;
  }
  .side.open .me {
    margin-top: 4px;
  }
}
