/* ==========================================================================
   TeamDesk styles
   Sign-in: teal KRH-coloured panel with waves, light side with the sign-in card.
   Portal: light dashboard, white rounded cards, green active pill, round chips.
   To change the font, edit --font.
   ========================================================================== */

:root {
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --bg: #e9eef0;
  --surface: #ffffff;
  --soft: #f3f6f7;
  --text: #1d2433;
  --muted: #667085;
  --subtle: #98a2b3;
  --border: #e8ecef;
  --border-strong: #d3dae0;

  /* Teal-green, leaning toward the KRH logo's teal */
  --primary: #0d8077;
  --primary-hover: #0a6a63;
  --primary-soft: #ddf1ee;
  --amber: #f5c400;
  --amber-soft: #fff4c7;
  --amber-text: #7f6200;
  --coral: #ff5a36;
  --coral-soft: #ffe7e0;
  --coral-text: #c23a1b;
  --blue-soft: #e3f1fb;
  --blue-text: #1f6fa8;
  --focus: rgba(13, 128, 119, 0.22);

  --danger: #d92d20;
  --danger-ink: #ffffff;
  --danger-soft: #fee9e6;

  /* Sign-in page */
  --navy: #0c3b4e;
  --sky: #74c3c8;
  --sky-hover: #60b6bc;
  --sky-soft: #e8f5f5;

  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
code { font-family: Consolas, "Courier New", monospace; font-size: 0.9em; }

/* Hugeicons (see assets/js/icons.js) */
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand img { display: block; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn:disabled { cursor: progress; opacity: 0.8; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { color: #ffffff; background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--soft); }
.btn-danger { color: var(--danger-ink); background: var(--danger); }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-sm .icon { width: 15px; height: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.icon-btn:disabled { cursor: progress; opacity: 0.6; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 2px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 0;
  cursor: pointer;
}
.text-btn .icon { width: 15px; height: 15px; }
.text-btn:hover { text-decoration: underline; }
.text-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

.pill-link {
  flex: none;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
a.pill-link:hover { background: var(--soft); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 999px;
}
.tag-green { color: var(--primary-hover); background: var(--primary-soft); }
.tag-amber { color: var(--amber-text); background: var(--amber-soft); }

.chip {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
}
.chip-green { color: var(--primary-hover); background: var(--primary-soft); }
.chip-amber { color: var(--amber-text); background: var(--amber-soft); }
.chip-coral { color: var(--coral-text); background: var(--coral-soft); }
.chip-blue { color: var(--blue-text); background: var(--blue-soft); }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.text-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}
.text-input::placeholder { color: var(--subtle); }
.text-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.file-input { height: auto; padding: 8px 12px; }
.select-sm { width: 180px; height: 34px; padding: 0 10px; font-size: 13px; border-radius: 999px; }
.hint { margin-top: 5px; font-size: 12.5px; color: var(--muted); }

.checkbox { display: flex; align-items: center; gap: 9px; color: var(--muted); cursor: pointer; }
.checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }

.form-error {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 12px;
}
.page-error { margin-bottom: 14px; }

/* ==========================================================================
   Sign-in page
   Left: teal panel in the KRH logo's colours with a large outline logo at the bottom.
   Right: light side with a curved edge, the sign-in card and the four tools.
   ========================================================================== */
.page-login {
  display: grid;
  grid-template-columns: minmax(0, 56fr) minmax(460px, 44fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: #f2f6f7;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.login-hero {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(120% 80% at 18% 8%, rgba(143, 220, 215, 0.22), transparent 55%),
    linear-gradient(150deg, #0a4656 0%, #0b5f66 42%, #0d7d78 100%);
}
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* KRH logo as a large thin white outline (filter defined in index.html) */
.hero-watermark {
  position: absolute;
  left: 56%;
  bottom: -150px;
  width: min(780px, 100%, 86vh);
  height: auto;
  transform: translateX(-50%);
  filter: url(#logo-outline-white);
  opacity: 0.2;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; padding: 0 14% 140px 11%; }
.hero-brand { display: flex; align-items: center; gap: 22px; }
.hero-mark { width: clamp(64px, 6.4vw, 96px); height: auto; flex: none; }
.hero-name {
  font-size: clamp(46px, 5.6vw, 84px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}
.hero-name span { color: #8fdcd7; }
.hero-rule { display: block; width: 76px; height: 5px; margin: 34px 0 26px; background: #8fdcd7; border-radius: 3px; }
.hero-tagline {
  max-width: 17ch;
  font-size: clamp(24px, 2.4vw, 36px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #eaf7f6;
}

.login-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 48px 64px 24px;
  background: #f2f6f7;
}
.login-curve { position: absolute; top: 0; bottom: 0; left: -240px; width: 241px; height: 100%; fill: #f2f6f7; pointer-events: none; }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  padding: 36px 40px 30px;
  text-align: center;
  background: #ffffff;
  border-radius: 26px;
  box-shadow: 0 1px 2px rgba(12, 59, 78, 0.05), 0 24px 60px rgba(12, 59, 78, 0.10);
}
.card-accent {
  position: absolute;
  top: 0;
  left: 50%;
  width: 42%;
  height: 5px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #4fbdb6, #0d8077);
  border-radius: 0 0 6px 6px;
}
.card-logo { display: block; width: 72px; height: 72px; margin: 0 auto 10px; }
.login-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; color: var(--navy); }
.card-sub { margin: 4px 0 24px; font-size: 14px; color: var(--muted); }

#login-form { display: grid; gap: 14px; text-align: left; }
.icon-field { position: relative; }
.icon-field > .icon { position: absolute; left: 15px; top: 15px; width: 20px; height: 20px; color: #6f8a94; pointer-events: none; }
.icon-field .text-input { height: 50px; padding-left: 46px; border-color: #d6e2e5; border-radius: 13px; }
.icon-field .text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.icon-field .text-input:focus + .icon, .icon-field:focus-within > .icon { color: var(--primary); }
#password { padding-right: 48px; }
.input-wrap { position: relative; }
.input-action { position: absolute; right: 6px; top: 7px; border: 0; background: transparent; }

.login-submit {
  gap: 10px;
  height: 50px;
  font-size: 15px;
  color: #ffffff;
  background: linear-gradient(180deg, #0f8a80, #0b6f69);
  border-radius: 13px;
}
.login-submit:hover:not(:disabled) { background: linear-gradient(180deg, #0c7d74, #095f5a); }
.submit-icon .icon, .login-submit > .icon { width: 20px; height: 20px; }
.notice { margin-bottom: 14px; padding: 10px 14px; font-size: 13px; text-align: left; color: var(--amber-text); background: var(--amber-soft); border-radius: 12px; }
.help { margin-top: 16px; font-size: 13px; color: var(--muted); }
#newpw-form { display: grid; gap: 14px; text-align: left; }
.newpw-hint { margin: -4px 2px 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.link-btn { justify-self: center; padding: 4px 8px; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--primary); }

.login-features {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 430px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}
.login-features li {
  display: grid;
  justify-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}
.login-features li + li { border-left: 1px solid #d6e2e5; }
.login-features .icon { width: 30px; height: 30px; color: var(--primary); }

@media (min-width: 1600px) {
  .login-card { max-width: 470px; padding: 44px 46px 34px; }
  .card-logo { width: 84px; height: 84px; }
  .login-card h1 { font-size: 34px; }
  .login-features { max-width: 470px; }
}

/* ==========================================================================
   App shell
   ========================================================================== */
body.is-loading .shell { visibility: hidden; }

.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 14px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
}
.side-head {
  position: relative;
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.side-head .brand-name { white-space: nowrap; }
.side-toggle {
  position: absolute;
  right: 0;
  top: 22px;
  width: 26px;
  height: 30px;
  color: #ffffff;
  background: var(--primary);
  border: 0;
  border-radius: 8px 0 0 8px;
}
.side-toggle:hover { background: var(--primary-hover); }
.side-toggle .icon { width: 15px; height: 15px; }

.side-label { padding: 16px 20px 6px; font-size: 13px; color: var(--muted); }
.side-nav { display: grid; align-content: start; gap: 4px; padding: 0 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 8px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  border-radius: 999px;
}
.nav-chip {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--text);
  background: var(--soft);
  border-radius: 50%;
}
.nav-chip .icon { width: 17px; height: 17px; }
.nav-item:hover { background: var(--soft); }
.nav-item:hover .nav-chip { background: var(--surface); }
.nav-item.is-active { font-weight: 600; color: #ffffff; background: var(--primary); }
.nav-item.is-active .nav-chip { color: var(--primary); background: #ffffff; }

/* "Designed and developed by" credit */
.side-credit { margin-top: auto; padding: 14px 20px 18px; font-size: 11.5px; line-height: 1.4; color: var(--subtle); }
.page-credit { display: none; padding: 4px 4px 8px; font-size: 11.5px; text-align: center; color: var(--subtle); }
.login-credit { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0; font-size: 12px; text-align: center; color: var(--subtle); }

/* ---------- Top bar ---------- */
.main { min-width: 0; display: grid; align-content: start; gap: 14px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 20px;
}
.top-search { flex: 1; max-width: 340px; border-radius: 999px; }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 16px 4px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-hover);
  background: var(--primary-soft);
  border-radius: 50%;
}
.avatar-1 { color: var(--blue-text); background: var(--blue-soft); }
.avatar-2 { color: var(--amber-text); background: var(--amber-soft); }
.avatar-3 { color: var(--coral-text); background: var(--coral-soft); }
.user-meta { display: grid; min-width: 0; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.user-role { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.topbar .icon-btn { width: 40px; height: 40px; }

.test-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--amber-text);
  background: var(--amber-soft);
  border-radius: 12px;
}
.test-banner .icon { width: 15px; height: 15px; }

.content { min-width: 0; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 2px 4px;
}
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.date { font-size: 13px; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 16px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 0;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }

.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-bar .search { flex: 1; min-width: 0; max-width: 420px; height: 42px; }
.filter-bar .filter-select { flex: none; width: 220px; border-radius: 999px; }
.page-hint { margin: 0 4px 12px; }

/* ---------- Cards, tables ---------- */
.list, .panel { background: var(--surface); border-radius: 18px; overflow: hidden; }
.list { padding: 6px 8px; }

.list-head { font-size: 13px; font-weight: 500; color: var(--muted); }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.row:first-child, .list-head + div > .row:first-child { border-top: 0; }
.row:hover { background: var(--soft); border-radius: 12px; }
.row-icon { display: grid; place-items: center; color: var(--primary-hover); background: var(--primary-soft); width: 38px; height: 38px; flex: none; border-radius: 12px; }
.row-body { flex: 1; min-width: 0; }
.row-body h3 { font-size: 14px; font-weight: 600; }
.row-body p { font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.row-body p.word-note { margin-top: 2px; color: var(--amber-text); }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--surface); border-radius: 18px; }

.panel { padding: 16px 16px 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.panel-list .row { min-height: 56px; padding: 8px 6px; }
.panel-empty { padding: 12px 6px; color: var(--muted); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.col-stack { display: grid; gap: 14px; }

/* Shortcut cards on staff Home */
/* Large while there are only a few sections. With many more, lower min-height and the icon size. */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 14px; }
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 210px;
  padding: 24px;
  color: var(--text);
  background: var(--surface);
  border-radius: 22px;
  transition: background-color 0.15s;
}
.quick-card:hover { background: var(--primary-soft); }
.quick-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.quick-card .chip { width: 60px; height: 60px; border-radius: 18px; }
.quick-card .chip .icon { width: 28px; height: 28px; }
.quick-card .row-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}
.quick-card:hover .row-arrow { color: #ffffff; background: var(--primary); border-color: var(--primary); }
.quick-body { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.quick-body strong { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }

/* Number cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { display: grid; gap: 8px; padding: 16px; color: var(--text); background: var(--surface); border-radius: 18px; }
.stat:hover .pill-link { background: var(--soft); }
.stat:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.stat-main { display: flex; align-items: center; gap: 10px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12.5px; color: var(--muted); }

/* Horizontal bars: every value is labelled */
.bars { display: grid; gap: 10px; padding: 4px 2px 8px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 30px; align-items: center; gap: 10px; color: var(--text); }
.bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: var(--soft); border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 7px; }
.bar-value { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.action-list { display: grid; gap: 6px; padding-bottom: 6px; }
.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 4px 8px;
  font: inherit;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: var(--soft);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.action-item:hover { background: var(--primary-soft); }
.action-item:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.action-item .nav-chip { background: var(--surface); }

.attention-row { color: inherit; }
.attention-row h3 { font-weight: 500; }
.attention-row .row-icon { color: var(--coral-text); background: var(--coral-soft); }
.attention-row .row-arrow { color: var(--muted); }
.ok-row .row-icon { color: var(--primary-hover); background: var(--primary-soft); }

.dept-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 6px; color: var(--text); border-top: 1px solid var(--border); }
.dept-link:first-child { border-top: 0; }
.dept-link:hover { background: var(--soft); border-radius: 10px; }

/* ---------- Contact directory table ---------- */
.contact-head,
.contact-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 2fr) minmax(0, 1.4fr) 312px;
  align-items: center;
  gap: 0 12px;
  padding: 8px 12px;
}
.contact-head { min-height: 40px; }
.contact-head > span:first-child { grid-column: 2; }
.contact-head .num-cols { display: grid; grid-template-columns: repeat(3, 104px); }
.contact-head .num-cols span { padding-left: 8px; }
.contact-row { min-height: 58px; }
.contact-row .avatar { grid-column: 1; }
.contact-row .row-body { display: contents; }
.contact-row .row-body h3 { grid-column: 2; }
.contact-row .row-body p { grid-column: 3; font-size: 13.5px; }

.number-lines { grid-column: 4; flex-direction: column; align-items: stretch; gap: 0; }
.number-line { display: grid; grid-template-columns: repeat(3, 104px); align-items: center; }

.num {
  display: block;
  padding: 2px 8px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
}
button.num { cursor: pointer; }
button.num:hover { color: var(--primary-hover); background: var(--primary-soft); }
button.num:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.num-label { display: none; font-size: 12px; color: var(--muted); }
.num-value { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-empty .num-value { color: var(--subtle); font-weight: 400; }
.call-link { display: none; }

/* Number lines in the contact form */
.number-head,
.number-edit { display: grid; grid-template-columns: 1fr 1fr 1fr 32px; gap: 8px; align-items: center; }
.number-head { margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.number-edit + .number-edit { margin-top: 8px; }

/* ---------- Links ---------- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 16px; color: var(--text); background: var(--surface); border-radius: 18px; }
.link-card:hover { background: var(--primary-soft); }
.link-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.link-card-body { display: grid; flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.link-card-body strong { font-size: 14.5px; font-weight: 600; color: var(--text); }
.link-card-body small { font-size: 11.5px; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Guides ---------- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.guide-card { display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--text); background: var(--surface); border-radius: 18px; }
.guide-card:hover { background: var(--primary-soft); }
.guide-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.guide-card-body { display: grid; flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.guide-card-body strong { font-size: 14px; font-weight: 600; color: var(--text); }
.row-arrow { display: grid; place-items: center; color: var(--muted); }

.guide-sheet { padding: 12px; background: var(--surface); border-radius: 18px; }
.guide-scroll { overflow-x: auto; border-radius: 12px; }
.guide-table.is-wide { min-width: 760px; }
.guide-table.is-sheet { text-align: left; }
.guide-table td.is-blank { padding: 0; background: transparent; }
.guide-table a { font-weight: 600; word-break: break-word; }
.guide-images { display: grid; gap: 12px; justify-items: center; margin-top: 8px; }
.guide-images img { display: block; max-width: 100%; height: auto; border-radius: 12px; }
.guide-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 14px;
  text-align: center;
}
.guide-table th {
  padding: 12px 10px;
  font-weight: 700;
  color: #ffffff;
  background: var(--text);
  border-radius: 10px;
}
.guide-table td { padding: 11px 12px; line-height: 1.4; color: var(--text); border-radius: 10px; }
.guide-table strong { font-weight: 700; }
.tone-yellow { background: #fff1c9; }
.tone-orange { background: #fbd9b0; }
.tone-pink { background: #fbdcdb; }
.tone-rose { background: #f1b6b1; }
.tone-peach { background: #fde8d3; }
.tone-dark { background: #4b5563; }
.tone-plain { background: var(--soft); }

/* ---------- Import preview ---------- */
.import-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.import-list:focus { outline: none; border-color: var(--primary); }
.import-row { display: flex; align-items: center; gap: 10px; min-height: 0; padding: 7px 12px; border-top: 1px solid var(--border); }
.import-row:first-child { border-top: 0; }
.import-num { flex: none; width: 72px; font-size: 13px; font-variant-numeric: tabular-nums; }
.import-head { position: sticky; top: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--soft); }
.import-head .import-num { font-size: 12.5px; }

/* ---------- Dialogs ---------- */
.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 20px;
}
.modal-wide { width: min(620px, calc(100vw - 32px)); }
.modal-sm { width: min(400px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(20, 30, 45, 0.45); }
.modal form { display: grid; gap: 14px; }
.modal h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.checks { margin: 0; padding: 0; border: 0; }
.checks legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 600; }
.checks > div { display: grid; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-body { display: grid; gap: 8px; }
.confirm-body p { color: var(--muted); }
.confirm-body .modal-actions { margin-top: 10px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: var(--text);
  border-radius: 999px;
}

/* Print blank: only the drawn form pages reach the paper */
#print-area { display: none; }
@media print {
  body.printing { background: #ffffff; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  #print-area img { display: block; break-after: page; }
  #print-area img:last-child { break-after: auto; }
}

/* ---------- Collapsed sidebar (desktop only) ---------- */
@media (min-width: 861px) {
  .shell.can-animate { transition: grid-template-columns 0.15s ease; }
  .shell.is-collapsed { grid-template-columns: 74px minmax(0, 1fr); }

  .is-collapsed .side-head { flex-direction: column; justify-content: center; gap: 10px; height: auto; padding: 16px 0 12px; }
  .is-collapsed .side-toggle { position: static; width: 36px; height: 24px; border-radius: 8px; }
  .is-collapsed .brand-name,
  .is-collapsed .side-credit,
  .is-collapsed .side-label,
  .is-collapsed .nav-item span { display: none; }
  .is-collapsed .side-nav { padding: 12px 10px 0; }
  .is-collapsed .nav-item { justify-content: center; justify-self: center; width: 48px; padding: 0; }
}

/* ---------- Smaller screens ---------- */
@media (max-width: 1180px) {
  .home-grid { grid-template-columns: 1fr; }
  .hero-content { padding-left: 8%; padding-right: 8%; }
  .login-side { padding-right: 32px; }
}

@media (max-width: 900px) {
  .page-login { display: block; }
  .login-hero { min-height: 0; padding: 44px 0 120px; }
  .hero-content { padding: 0 24px; }
  .hero-brand { gap: 14px; }
  .hero-rule { margin: 20px 0 16px; }
    .hero-watermark { width: 420px; left: 64%; bottom: -40px; }
  .login-curve { display: none; }
  .login-side { padding: 0 16px 56px; margin-top: -56px; background: transparent; }
  .login-card { padding: 30px 22px 24px; }
  .login-features .icon { width: 24px; height: 24px; }
}

@media (max-width: 860px) {
  .shell { display: block; padding: 10px; }
  .side-toggle, .side-label, .side-credit { display: none; }
  .page-credit { display: block; }
  .sidebar { position: static; height: auto; margin-bottom: 10px; }
  .side-head { height: 58px; }
  .side-nav { display: flex; padding: 8px; overflow-x: auto; border-top: 0; }
  .nav-item { flex: 1; justify-content: center; gap: 6px; height: 42px; padding: 0 12px; }
  .nav-chip { display: none; }
  .main { gap: 10px; }
  .topbar { min-height: 0; padding: 10px; border-radius: 16px; }
  .user-meta { display: none; }
  .user-pill { padding: 0; border: 0; }
}

@media (max-width: 780px) {
  .contact-head { display: none; }
  .contact-row { display: block; padding: 10px 8px; }
  .contact-row .avatar { display: none; }
  .contact-row .row-body { display: block; margin-bottom: 4px; }
  .contact-row .row-body p { font-size: 12.5px; }
  .number-line { grid-template-columns: 1fr 1fr 1fr 32px; }
  .num { padding-left: 0; }
  .num-label { display: block; }
  .number-line + .number-line .num-label { display: none; }
  .call-link { display: inline-grid; }
  .call-spacer { visibility: hidden; }

  .row { flex-wrap: wrap; }
  .row-body { flex-basis: calc(100% - 56px); }
  .row-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .contact-row .row-actions { display: block; width: auto; }
  .select-sm { flex: 1; width: auto; min-width: 0; }

  .filter-bar { flex-direction: column; }
  .filter-bar .search { flex: none; max-width: none; }
  .filter-bar .filter-select { width: 100%; }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 28px; }
  .quick-card { min-height: 0; gap: 18px; padding: 18px; }
  .import-num { width: 58px; font-size: 12.5px; }
}
