/* Exceed Technology portal — tokens follow the Nelson Technology design system
   (Source Sans 3, 8px spacing, 4px radius, flat surfaces). The accent is Exceed's own;
   swap --accent / --accent-dark once the Exceed brand tokens are settled. */
:root {
  --charcoal: #57585B; --charcoal-dark: #3D3E40; --charcoal-deep: #252627; --charcoal-light: #6E6F72;
  --paper: #F5F5F5; --white: #FFFFFF; --line: #DADBDD; --ink: #252627; --ink-soft: #6E6F72;
  --accent: #1589A3; --accent-dark: #0F6A7E; --warn: #C2471D;
  --font: "Source Sans 3", "Myriad Pro", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-family: var(--font); font-size: 17px; line-height: 1.45; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-weight: 300; font-size: 2rem; letter-spacing: -0.01em; margin: 0 0 8px; }
h2 { font-weight: 600; font-size: 1.15rem; margin: 0 0 8px; }
.lede { color: var(--ink-soft); font-size: 1.1rem; max-width: 60ch; margin: 0 0 24px; }
.dim { color: var(--ink-soft); }
.warn { color: var(--warn); }

/* Top bar */
.top { background: var(--charcoal-dark); color: var(--white); display: flex; align-items: center; gap: 32px; padding: 0 24px; height: 56px; }
.wordmark { color: var(--white); text-decoration: none; font-weight: 300; font-size: 1.5rem; letter-spacing: 0.04em; }
.wordmark .lead { color: var(--accent); }
.wordmark .suffix { color: var(--charcoal-light); font-size: 0.75em; margin-left: 2px; }
.nav { display: flex; gap: 24px; flex: 1; }
.nav a { color: var(--white); text-decoration: none; padding: 16px 0; border-bottom: 2px solid transparent; }
.nav a.on { border-color: var(--accent); }
.who { display: flex; align-items: baseline; gap: 12px; font-size: 0.9rem; }
.who .dim { color: var(--charcoal-light); }
.who form { margin: 0; }
button.link { background: none; border: 0; color: var(--white); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* Page */
.page { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 24px 48px; }
.foot { border-top: 1px solid var(--line); padding: 16px 24px; font-size: 0.85rem; color: var(--ink-soft); max-width: 1120px; margin: 0 auto; width: 100%; }
.foot p { margin: 4px 0; max-width: 80ch; }

/* Forms */
.signin { max-width: 440px; margin: 48px auto 0; background: var(--white); padding: 32px; border: 1px solid var(--line); border-radius: 4px; }
.form label, .rangebar label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--ink-soft); }
.form label { margin-bottom: 16px; }
input, select { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.primary, .button { font: inherit; font-weight: 600; background: var(--accent); color: var(--white); border: 0; border-radius: 4px; padding: 9px 18px; cursor: pointer; text-decoration: none; display: inline-block; }
.primary:hover, .button:hover { background: var(--accent-dark); }
.alert { background: #FBEAE3; color: var(--warn); border-radius: 4px; padding: 8px 12px; margin: 0 0 16px; }

/* Tiles (home) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 20px; text-decoration: none; color: var(--ink); }
a.tile:hover { border-color: var(--accent); }
.tile p { margin: 0; color: var(--ink-soft); }
.tile.soon { opacity: 0.6; }

/* Range bar */
.rangebar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 16px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.rangebar .showing { align-self: center; margin-left: auto; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin: 0 0 32px; }
.stats div { background: var(--white); border-left: 3px solid var(--accent); padding: 12px 16px; }
.stats dt { font-size: 0.85rem; color: var(--ink-soft); }
.stats dd { margin: 0; font-size: 1.8rem; font-weight: 300; line-height: 1.1; }

/* Daily trend — the one place the page gets visual */
.trend { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 0 0 24px; margin-bottom: 32px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.trend .bar { flex: 1 0 22px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.trend .fill { display: block; width: 100%; max-width: 40px; background: var(--charcoal); position: relative; }
.trend .missed { position: absolute; bottom: 0; left: 0; right: 0; background: var(--warn); }
.trend .lbl { font-size: 0.7rem; color: var(--ink-soft); position: absolute; bottom: -22px; white-space: nowrap; }

/* Tables */
.tablehead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.scroll { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 4px; }
.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data th, .data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.data th { font-weight: 600; color: var(--ink-soft); font-size: 0.85rem; background: var(--paper); }
.data tr:last-child td { border-bottom: 0; }
.data .n { text-align: right; font-variant-numeric: tabular-nums; }
.data tr.is-missed td:nth-child(5) { color: var(--warn); }
.nowrap { white-space: nowrap; }
.empty { background: var(--white); border: 1px dashed var(--line); padding: 24px; text-align: center; color: var(--ink-soft); }
.crumb { margin: 0 0 4px; font-size: 0.9rem; }

@media (max-width: 720px) {
  .top { gap: 16px; height: auto; flex-wrap: wrap; padding: 8px 16px; }
  .nav { order: 3; width: 100%; }
  .nav a { padding: 8px 0; }
  .page { padding: 24px 16px 40px; }
  .stats dd { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: no-preference) { .primary, .button, .tile { transition: background .12s, border-color .12s; } }

/* Staff sign-in */
.staff { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.9rem; }
.button.ghost { background: transparent; color: var(--accent-dark); border: 1px solid var(--accent); }
.button.ghost:hover { background: var(--accent); color: var(--white); }

/* Yealink module */
.subnav { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.subnav a { text-decoration: none; color: var(--ink-soft); padding: 8px 0; border-bottom: 2px solid transparent; }
.subnav a.on { color: var(--ink); border-color: var(--accent); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 20px; margin-bottom: 28px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); }
.inline-form label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 10px; }
.inline-form.compact { gap: 8px; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form.grid2 label { margin: 0; }
.span2 { grid-column: 1 / -1; }
.flash { border-radius: 4px; padding: 8px 12px; margin: 0 0 16px; }
.flash.ok { background: #E4F3DC; color: #2F5F1E; }
.flash.error { background: #FBEAE3; color: var(--warn); }
.status { display: inline-block; font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; background: var(--paper); color: var(--ink-soft); }
.status.registered { background: #E4F3DC; color: #2F5F1E; }
.status.failed { background: #FBEAE3; color: var(--warn); }
.status.pending { background: #FFF4D6; color: #7A5A00; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.9rem; }
.small { font-size: 0.85rem; }
.actions { white-space: nowrap; }
.actions form { display: inline; margin-left: 8px; }
.actions button.link { color: var(--accent-dark); }
.actions button.link.danger { color: var(--warn); }
@media (max-width: 720px) { .form.grid2 { grid-template-columns: 1fr; } }

/* Landing */
.hero { padding: 32px 0 40px; max-width: 64ch; }
.hero h1 { font-size: 2.6rem; line-height: 1.1; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.button.small { padding: 6px 14px; font-size: 0.9rem; }
.tiles.three { margin-bottom: 40px; }
.strip { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; border-top: 1px solid var(--line); padding-top: 32px; }
.strip p { color: var(--ink-soft); margin: 0; }
code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.9em; background: var(--white); padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; }
.page.wide { max-width: 1320px; }
@media (max-width: 720px) { .hero h1 { font-size: 2rem; } .strip { grid-template-columns: 1fr; } }

/* Connection test */
.testgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 8px 0 20px; }
.stage { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 4px; padding: 14px 16px; }
.stage .lbl { font-size: 0.85rem; color: var(--ink-soft); }
.stage .val { font-size: 1.25rem; font-weight: 600; margin: 4px 0 6px; min-height: 1.6em; }
.stage .why { font-size: 0.85rem; color: var(--ink-soft); }
.stage[data-state="run"] { border-left-color: var(--accent); }
.stage[data-state="run"] .val::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
.stage[data-state="ok"] { border-left-color: #5FA040; }
.stage[data-state="warn"] { border-left-color: #D9A400; }
.stage[data-state="bad"] { border-left-color: var(--warn); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stage[data-state="run"] .val::after { animation: none; } }
#verdict[data-v="good"], .verdict-pill[data-v="good"] { color: #2F5F1E; }
#verdict[data-v="fair"], .verdict-pill[data-v="fair"] { color: #7A5A00; }
#verdict[data-v="poor"], .verdict-pill[data-v="poor"] { color: var(--warn); }
.verdict-pill { font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--paper); vertical-align: middle; }
.share { display: flex; gap: 8px; align-items: center; }
.share input { flex: 1; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85rem; }
.stats dd small { font-size: 0.8rem; color: var(--ink-soft); font-weight: 400; }
details.panel summary { cursor: pointer; font-weight: 600; }
pre { white-space: pre-wrap; word-break: break-all; }

/* Help desk */
.form.ticket fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 16px 20px 8px; margin: 0 0 20px; background: var(--white); }
.form.ticket legend { font-weight: 600; padding: 0 6px; }
.form.ticket .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form.ticket .grid3, .form .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.form .hint { font-size: 0.8rem; color: var(--ink-soft); font-weight: 400; }
.form label .hint { margin-top: 2px; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; width: 100%; box-sizing: border-box; }
.alert ul { margin: 0; padding-left: 20px; }
.status.s-open { background: #E4F3DC; color: #2F5F1E; }
.status.s-in-progress { background: #DDEFF4; color: #0F6A7E; }
.status.s-waiting { background: #FFF4D6; color: #7A5A00; }
.status.s-resolved, .status.s-closed { background: var(--paper); color: var(--ink-soft); }
tr.pri-3 td:first-child { border-left: 3px solid var(--warn); }
tr.pri-2 td:first-child { border-left: 3px solid #D9A400; }
.ticket-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.facts dl { margin: 0; }
.facts dt { font-size: 0.8rem; color: var(--ink-soft); margin-top: 10px; }
.facts dd { margin: 0; }
.thread .note { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px; margin-bottom: 12px; }
.thread .note.tech { border-left: 3px solid var(--accent); }
.thread .note.internal { background: #FFFBEB; border-color: #F0DFA0; }
.thread .note header { font-size: 0.9rem; margin-bottom: 6px; }
.thread .note p { margin: 0; }
.tag { font-size: 0.7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--white); margin-left: 4px; }
.tag.internal { background: #D9A400; }
.form label.check { flex-direction: row; align-items: center; gap: 6px; }
@media (max-width: 800px) { .ticket-layout, .form.ticket .grid2, .form .grid3 { grid-template-columns: 1fr; } }

/* ALG check */
.alg { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.alg h3 { margin: 0 0 6px; font-size: 1.05rem; }
.cmds label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin: 10px 0; }
.cmds .row { display: flex; gap: 8px; margin-top: 4px; }
.cmds input { flex: 1; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; }
#reg-out { background: var(--paper); padding: 8px; margin-top: 6px; max-height: 240px; overflow: auto; }
