/* Velocity TalkDesk — application styles.
   No build step, no framework: one stylesheet, served static.
   Shell = fixed left sidebar + topbar + scrollable content, collapsing to a
   drawer on phones. */

:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e5eaee;
  --text: #16202a;
  --muted: #6b7a89;
  --brand: #14b8a6;
  --brand-dark: #0f766e;
  --brand-soft: #e6faf7;
  --accent: #6366f1;
  --accent-soft: #eef0ff;
  --danger: #e5484d;
  --warn: #f5a524;
  --warn-bg: #fef8ec;
  --warn-border: #f7d9a0;
  --err-bg: #fdeced;
  --err-border: #f5b5b7;
  --info-bg: #eef0ff;
  --info-border: #c7cbf7;
  --sidebar-bg: #0f2a33;
  --sidebar-text: #9fc2c9;
  --sidebar-active: #14b8a6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 42, .04), 0 6px 20px rgba(16, 32, 42, .06);
  --shadow-lg: 0 12px 40px rgba(16, 32, 42, .16);
  --sidebar-w: 236px;
  --sidebar-w-sm: 72px;
  --topbar-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161b;
    --surface: #182027;
    --surface-2: #1d262e;
    --border: #2a353e;
    --text: #e6edf3;
    --muted: #92a2b1;
    --brand-soft: #10302c;
    --accent-soft: #1d2140;
    --warn-bg: #2b2213;
    --warn-border: #5e4a1f;
    --err-bg: #2c1618;
    --err-border: #6a2c2f;
    --info-bg: #1a1d33;
    --info-border: #333a6b;
    --sidebar-bg: #0c141a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #11161b; --surface: #182027; --surface-2: #1d262e; --border: #2a353e;
  --text: #e6edf3; --muted: #92a2b1; --brand-soft: #10302c; --accent-soft: #1d2140;
  --warn-bg: #2b2213; --warn-border: #5e4a1f; --err-bg: #2c1618; --err-border: #6a2c2f;
  --info-bg: #1a1d33; --info-border: #333a6b; --sidebar-bg: #0c141a;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
body.public { display: flex; flex-direction: column; }

a { color: var(--brand-dark); }
code { font-family: var(--mono); font-size: .92em; }
hr.rule { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }

.ic {
  width: 19px; height: 19px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ============================================================ app shell */
body.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

.sidebar {
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  z-index: 60;
}
.sidebar-top { padding: 4px 8px 14px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.brand-mark.big { width: 52px; height: 52px; font-size: 18px; margin: 0 auto 14px; border-radius: 15px; }
.brand-text { font-weight: 650; color: #fff; letter-spacing: -.01em; font-size: 16px; }

.sidenav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 3px; padding-top: 10px;
                  border-top: 1px solid rgba(255,255,255,.08); }
.sidenav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 500; border: 0; background: none;
  cursor: pointer; width: 100%; text-align: left; font-family: inherit;
}
.sidenav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidenav-item.on { background: var(--sidebar-active); color: #06231f; font-weight: 650; }
.sidenav-item.on .ic { stroke-width: 2.2; }

.shell-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-h { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: none; border: 1px solid transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 14px;
}
.who { display: flex; flex-direction: column; line-height: 1.25; }
.who-name { font-weight: 600; font-size: 13px; }
.who-company { font-size: 12px; color: var(--muted); }

.content { flex: 1; padding: 24px 22px 60px; max-width: 1240px; width: 100%; }
.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(8,14,18,.5); z-index: 55; }

/* ---------------------------------------------------------- public pages */
.plain-main { flex: 1; }
.hero { background: linear-gradient(160deg, var(--brand-soft), var(--bg) 70%); }
.hero-inner { max-width: 760px; margin: 0 auto; padding: 60px 20px 44px; text-align: center; }
.hero-inner h1 { margin: 0 0 12px; font-size: 34px; letter-spacing: -.035em; line-height: 1.15; }
.hero-sub { margin: 0; color: var(--muted); font-size: 16px; }

.panel-wrap { max-width: 760px; margin: 0 auto; padding: 26px 20px 60px; }
.panel-wrap.narrow { max-width: 460px; }
.panel-wrap.tall { padding-top: 7vh; }

/* -------------------------------------------------------- common blocks */
.page-head { margin-bottom: 20px; display: flex; justify-content: space-between;
             align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 3px; font-size: 22px; letter-spacing: -.025em; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px;
}
.panel.flat { box-shadow: none; margin-bottom: 18px; padding: 22px; }
.panel-head { margin-bottom: 20px; }
.panel-head.center { text-align: center; }
.panel-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.sub { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: var(--mono); font-size: 13px; }

/* ----------------------------------------------------------------- forms */
.fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.fieldset legend {
  padding: 0; margin-bottom: 12px; font-weight: 650; font-size: 12px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.field { margin-bottom: 16px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { min-width: 200px; }
.field label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 5px; }
.req { color: var(--danger); }
.field input, .field select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input.invalid { border-color: var(--danger); }
.field input.invalid:focus { box-shadow: 0 0 0 3px var(--err-bg); }
.hint { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.hint-ok { color: var(--brand-dark); font-weight: 550; }
.hint-bad { color: var(--danger); font-weight: 550; }
.field-error { margin: 5px 0 0; font-size: 12px; color: var(--danger); }
.note {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; color: var(--muted); margin: 0;
}
.form-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.form-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; min-width: 170px; }
.field-action { flex: none; }
.inline { display: inline; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 17px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1.3;
  transition: background .12s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--brand-dark); color: #fff; }
.btn-primary:hover { background: #0c5f59; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger { color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.full { width: 100%; }
.select-sm {
  padding: 6px 9px; font: inherit; font-size: 13px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
}

/* ---------------------------------------------------------------- alerts */
.alert { padding: 13px 15px; border-radius: var(--radius-sm); margin-bottom: 18px;
         font-size: 14px; border: 1px solid; }
.alert-error { background: var(--err-bg); border-color: var(--err-border); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); }

/* ----------------------------------------------------------- credentials */
.success-mark {
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  color: #fff; display: grid; place-items: center; font-size: 24px; margin: 0 auto 14px;
}
.cred-block {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 16px; margin-bottom: 16px;
}
.cred-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; flex-wrap: wrap;
            border-bottom: 1px solid var(--border); }
.cred-row:last-child { border-bottom: 0; }
.cred-label { width: 118px; font-size: 13px; color: var(--muted); flex: none; }
.cred-value { flex: 1; font-family: var(--mono); font-size: 14px; word-break: break-all;
              user-select: all; min-width: 130px; }
.cred-password { font-size: 17px; font-weight: 650; letter-spacing: .05em; }
.cred-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.steps { padding-left: 20px; color: var(--muted); font-size: 14px; }
.steps li { margin-bottom: 7px; }

/* ----------------------------------------------------------------- cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
         gap: 16px; margin-bottom: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
              font-weight: 600; }
.card-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); flex: none;
}
.card-icon.alt { background: var(--accent-soft); color: var(--accent); }
.card-value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.card-value.sm { font-size: 19px; }
.card-value.ok { color: var(--brand-dark); }
.card-value.off { color: var(--muted); }
.card-of { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 5px; }
.card-link { font-size: 13px; text-decoration: none; margin-top: 2px; font-weight: 550; }

.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.meter > i { display: block; height: 100%; border-radius: 99px;
             background: linear-gradient(90deg, var(--brand), var(--accent)); }
.meter.warn > i { background: var(--warn); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

/* ------------------------------------------------------------- checklist */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 9px 0; display: flex; align-items: center; gap: 11px; font-size: 14px;
                border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done { color: var(--muted); }
.tick {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; border: 1.5px solid var(--border); color: var(--muted);
}
li.done .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.soon { font-size: 11px; color: var(--muted); background: var(--surface-2);
        border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; margin-left: auto; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; padding: 9px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.row-off { opacity: .55; }
.u-cell { display: flex; align-items: center; gap: 10px; }
.u-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; font-size: 13px;
}

.pill {
  display: inline-block; font-size: 11px; font-weight: 650; padding: 3px 9px;
  border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); text-transform: capitalize;
}
.pill-ok { color: var(--brand-dark); border-color: var(--brand); background: var(--brand-soft); }
.pill-warn { background: var(--warn-bg); border-color: var(--warn-border); color: #8a5a06; }
.pill-owner { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pill-you { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

.footer { padding: 18px 20px; text-align: center; font-size: 12px; color: var(--muted); }

/* ============================================================== toolkit */
.vt-toasts {
  position: fixed; top: 16px; right: 16px; z-index: 9000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}
.vt-toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 13px 38px 13px 15px; font-size: 14px; position: relative;
  opacity: 0; transform: translateX(16px);
  transition: opacity .18s ease, transform .18s ease;
}
.vt-toast.in { opacity: 1; transform: translateX(0); }
.vt-toast-success { border-left-color: var(--brand); }
.vt-toast-error { border-left-color: var(--danger); }
.vt-toast-info { border-left-color: var(--accent); }
.vt-toast-x {
  position: absolute; top: 7px; right: 9px; background: none; border: 0;
  font-size: 19px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 4px;
}
.vt-toast-x:hover { color: var(--text); }

.vt-overlay {
  position: fixed; inset: 0; z-index: 9100; background: rgba(8, 14, 18, .55);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity .15s ease;
}
.vt-overlay.in { opacity: 1; }
.vt-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 24px; width: 100%; max-width: 420px;
}
.vt-modal.wide { max-width: 640px; }
.vt-modal-title { margin: 0 0 8px; font-size: 17px; letter-spacing: -.015em; }
.vt-modal-body { margin: 0; color: var(--muted); font-size: 14px; }
.vt-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.vt-no-scroll { overflow: hidden; }

.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: vt-spin .6s linear infinite;
}
.btn-ghost.is-busy::after { border-color: rgba(128,128,128,.3); border-top-color: var(--text); }
@keyframes vt-spin { to { transform: rotate(360deg); } }

/* ============================================================ responsive */
@media (max-width: 1080px) {
  :root { --sidebar-w: var(--sidebar-w-sm); }
  .brand-text, .sidenav-label { display: none; }
  .sidenav-item { justify-content: center; padding: 11px; }
  .sidebar { padding: 16px 10px; }
  .brand { justify-content: center; }
}

@media (max-width: 760px) {
  body.shell { grid-template-columns: 1fr; }
  :root { --sidebar-w: 236px; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: var(--sidebar-w); padding: 16px 12px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .brand-text, .sidenav-label { display: inline; }
  .sidenav-item { justify-content: flex-start; padding: 11px 12px; }
  .brand { justify-content: flex-start; }
  .only-mobile { display: grid; }
  .who { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 18px 14px 60px; }
  .hero-inner { padding: 40px 18px 32px; }
  .hero-inner h1 { font-size: 26px; }
  .panel-wrap { padding: 20px 14px 50px; }
  .panel { padding: 20px; border-radius: 12px; }
  .cred-label { width: 100%; }
  .table td, .table th { padding: 10px 8px; }
  .vt-toasts { top: auto; bottom: 16px; left: 16px; right: 16px; max-width: none; }
  .vt-toast { transform: translateY(16px); }
  .vt-toast.in { transform: translateY(0); }
}

@media (display-mode: standalone) {
  /* Installed as a PWA: respect the phone's safe areas. */
  .topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .content { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .vt-toast, .vt-overlay, .sidebar, .btn { transition: none; }
  .btn.is-busy::after { animation-duration: 2s; }
}

/* Footer: attribution, copyright, deployed version */
.footer.build {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 18px 20px 24px; margin-top: auto;
  font-size: 12px; line-height: 1.5; color: var(--muted);
  border-top: 1px solid var(--border); text-align: center;
}
.build-line { display: block; }
.build-version { font-family: var(--mono); font-size: 11px; opacity: .8; cursor: help; }
body.shell .shell-main { min-height: 100vh; min-height: 100dvh; }
