/* =========================================================
   Office Portal — app.css
   Light Apple / macOS workspace style.
   3-column layout: sidebar | workspace | status panel.
   No external resources. No build step. No CDN.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces */
  --bg: #f5f5f7;
  --bg-grad-1: #eceef2;
  --bg-grad-2: #f7f8fa;

  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-soft: rgba(255, 255, 255, 0.55);
  --card-solid: #ffffff;

  --border: rgba(0, 0, 0, 0.07);
  --border-soft: rgba(0, 0, 0, 0.05);
  --hairline: rgba(0, 0, 0, 0.06);

  /* Text */
  --text: #1d1d1f;
  --text-2: #515154;
  --text-3: #86868b;
  --text-4: #a1a1a6;

  /* Accents */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-pressed: #006edb;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-soft-2: rgba(0, 113, 227, 0.14);

  /* Status colors */
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #ff3b30;
  --red-soft: rgba(255, 59, 48, 0.12);
  --purple: #af52de;
  --purple-soft: rgba(175, 82, 222, 0.12);
  --indigo: #5856d6;
  --indigo-soft: rgba(88, 86, 214, 0.12);
  --pink: #ff2d55;
  --pink-soft: rgba(255, 45, 85, 0.12);
  --teal: #30b0c7;
  --teal-soft: rgba(48, 176, 199, 0.12);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-pill: 999px;

  /* Layout */
  --topbar-h: 60px;
  --sidebar-w: 232px;
  --aside-w: 300px;
  --content-max: 920px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", "Helvetica Neue", Roboto, "PingFang SC", "Microsoft YaHei",
    sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 80% -10%, #dfe6f1 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 0%, #e9e3f1 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
ul { list-style: none; }

/* ===========================================================
   APP SHELL — topbar + 3 columns
   =========================================================== */

.app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 18px 0 18px;
  height: var(--topbar-h);
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-left: 6px;
  min-width: 0;
}

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #0a84ff 0%, #0071e3 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.4);
  flex-shrink: 0;
}

.brand__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Search */
.search {
  position: relative;
  max-width: 460px;
  width: 100%;
  justify-self: center;
}

.search__input {
  width: 100%;
  height: 38px;
  padding: 0 64px 0 38px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search__input::placeholder { color: var(--text-4); }

.search__input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  font-size: 15px;
}

.search__kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-3);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 2px 6px;
  pointer-events: none;
}

/* Top-right cluster */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.chip:hover { background: #fff; border-color: var(--border); }

.chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chip--clock { font-variant-numeric: tabular-nums; cursor: default; }
.chip--clock:hover { background: rgba(255, 255, 255, 0.65); }

/* Status chip: neutral info dot, NOT a green health indicator.
   Indicates link configuration only (no live health check). */
.chip--status { cursor: default; }
.chip--status:hover { background: rgba(255, 255, 255, 0.65); }
.chip--status .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip--status.is-off .dot { background: var(--text-4); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 15px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.1s ease;
}

.icon-btn:hover { background: #fff; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* ===========================================================
   BODY — sidebar + workspace + aside
   =========================================================== */
.body {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--aside-w);
  align-items: start;
  gap: 0;
  min-height: 0;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 12px 24px;
  border-right: 1px solid var(--hairline);
  scrollbar-width: thin;
}

.nav-group + .nav-group { margin-top: 18px; }

.nav-group__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  padding: 0 10px 8px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav__item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.nav__item.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.32);
}

.nav__item.is-active .nav__ico { color: #fff; }

.nav__item:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.nav__ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 15px;
  color: var(--text-3);
}

.nav__item:hover .nav__ico { color: var(--text-2); }

.nav__label { flex: 1; min-width: 0; }

.nav__count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--r-pill);
  padding: 1px 7px;
}

.nav__item.is-active .nav__count {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- Workspace (center) ---------- */
.workspace {
  padding: 28px 28px 60px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

.view { display: none; animation: fadeUp 0.28s ease; }
.view.is-active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 26px;
}

.hero__eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.hero__title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.hero__desc {
  font-size: 15px;
  color: var(--text-3);
  max-width: 56ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* Section heading */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 14px;
}

.section-head__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-head__hint {
  font-size: 12.5px;
  color: var(--text-3);
}

/* Cards */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}

.card--pad { padding: 20px; }

.card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card__title h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Grids */
.grid {
  display: grid;
  gap: 16px;
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Task row */
.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.task:last-child { border-bottom: none; }

.task__ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.task__body { flex: 1; min-width: 0; }
.task__name { font-size: 13.5px; font-weight: 500; }
.task__meta { font-size: 12px; color: var(--text-3); }

/* Output row */
.out {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.out:last-child { border-bottom: none; }

.out__ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-weight: 600;
  background: var(--purple-soft);
  color: var(--purple);
}

.out__name {
  font-family: var(--mono);
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status dot/badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--ok     { background: var(--green-soft);  color: #1d9e3e; }
.badge--info   { background: var(--accent-soft); color: var(--accent); }
.badge--run    { background: var(--orange-soft); color: #b76b00; }
.badge--done   { background: var(--accent-soft-2); color: var(--accent); }
.badge--warn   { background: var(--orange-soft); color: #b76b00; }
.badge--err    { background: var(--red-soft);    color: #c0090e; }
.badge--off    { background: rgba(0,0,0,0.05);   color: var(--text-4); }
.badge--muted  { background: rgba(0,0,0,0.05);   color: var(--text-3); }

.badge--run::before {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Service card (grid tile) */
.svc {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.svc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
  opacity: 0.8;
}

.svc:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0,0,0,0.1);
}

.svc__head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.svc__ico {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.svc__ico--files  { background: var(--accent-soft);  color: var(--accent); }
.svc__ico--data   { background: var(--purple-soft);  color: var(--purple); }
.svc__ico--tasks  { background: var(--orange-soft);  color: #b76b00; }
.svc__ico--notify { background: var(--green-soft);   color: #1d9e3e; }

.svc__name { font-size: 14.5px; font-weight: 600; }
.svc__desc { font-size: 12.5px; color: var(--text-3); flex: 1; }

.svc__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.svc__btn:hover { background: var(--accent-hover); }
.svc__btn:active { transform: scale(0.97); }
.svc__btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.svc__btn.is-disabled,
.svc__btn:disabled {
  background: rgba(0,0,0,0.06);
  color: var(--text-4);
  cursor: not-allowed;
  pointer-events: none;
}

/* Generic buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.1s ease, box-shadow 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn--primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,113,227,0.28);
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost {
  color: var(--text);
  background: rgba(0,0,0,0.04);
  border-color: var(--border-soft);
}
.btn--ghost:hover { background: rgba(0,0,0,0.07); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* ===========================================================
   ASIDE — right status panel
   =========================================================== */
.aside {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 22px 18px 40px;
  border-left: 1px solid var(--hairline);
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.panel__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.panel__title small {
  font-weight: 500;
  font-size: 11px;
  color: var(--text-3);
}

.panel__note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-3);
}

/* Status rows */
.s-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.s-row:last-child { border-bottom: none; }
.s-row__label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
}
.s-row__ico {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(0,0,0,0.04);
}
.s-row__value { font-weight: 500; }

/* Today stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 12px;
}
.stat__label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.stat__value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 2px;
}
.stat__value--text { font-size: 14px; font-weight: 600; }

/* Quick actions */
.qa {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.qa:last-child { margin-bottom: 0; }
.qa:hover { background: #fff; }
.qa:active { transform: scale(0.98); }
.qa:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.qa__ico {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.qa__ico--green  { background: var(--green-soft);  color: #1d9e3e; }
.qa__ico--orange { background: var(--orange-soft); color: #b76b00; }
.qa__chev { margin-left: auto; color: var(--text-4); font-size: 14px; }

/* ---------- Error banner ---------- */
.banner {
  display: none;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  margin-bottom: 18px;
  background: var(--red-soft);
  border: 1px solid rgba(255,59,48,0.25);
  border-radius: var(--r-md);
  color: #b3000f;
  font-size: 13px;
}
.banner.is-visible { display: flex; }
.banner__close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}
.banner__close:hover { opacity: 1; }

/* Empty / placeholder helper */
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }

/* Sidebar/footer micro */
.foot-note {
  margin-top: auto;
  padding: 12px 10px 0;
  font-size: 11px;
  color: var(--text-4);
  line-height: 1.5;
}

/* Settings table */
.cfg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cfg-table th, .cfg-table td {
  text-align: left; padding: 11px 8px;
  border-bottom: 1px solid var(--border-soft);
}
.cfg-table th {
  font-weight: 600; color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.cfg-table td code {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  word-break: break-all;
}

/* Settings list rows */
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.set-row:last-child { border-bottom: none; }
.set-row__label { color: var(--text-2); }
.set-row__value { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ===========================================================
   RESPONSIVE
   =========================================================== */

/* Tablet: drop the right aside below the workspace */
@media (max-width: 1180px) {
  .body {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .aside {
    position: static;
    height: auto;
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid var(--hairline);
    flex-direction: row;
    flex-wrap: wrap;
    padding: 22px 22px 40px;
  }
  .aside .panel { flex: 1 1 240px; }
}

/* Smaller tablet: collapse sidebar into icon rail */
@media (max-width: 920px) {
  :root { --sidebar-w: 68px; }
  .nav__label, .nav__count, .nav-group__label { display: none; }
  .nav__item { justify-content: center; padding: 11px 0; }
  .brand__name { display: none; }
  .topbar { grid-template-columns: var(--sidebar-w) 1fr auto; padding-right: 12px; }
}

/* Phone: sidebar becomes a top horizontal scroll bar */
@media (max-width: 720px) {
  :root { --topbar-h: 116px; }

  .app { grid-template-rows: auto 1fr; }

  .topbar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 10px 12px;
    height: auto;
  }

  .brand { padding-left: 0; }
  .brand__name { display: inline; }

  .search { justify-self: stretch; max-width: none; }
  .search__kbd { display: none; }

  .top-actions {
    justify-self: stretch;
    justify-content: space-between;
  }
  .chip--clock { display: none; }

  /* Sidebar -> horizontal nav under topbar */
  .body { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
    padding: 8px 10px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 6px;
    order: -1;
  }
  .nav-group { display: contents; }
  .nav-group + .nav-group { margin-top: 0; }
  .nav-group__label { display: none; }
  .nav__item {
    flex: 0 0 auto;
    width: auto;
    padding: 8px 13px;
    margin-bottom: 0;
  }
  .nav__label { display: inline; }
  .nav__count { display: inline; }

  .aside { padding: 18px 14px 40px; }
  .aside .panel { flex: 1 1 100%; }

  .workspace { padding: 20px 16px 50px; }
  .hero__title { font-size: 27px; }

  .grid--2 { grid-template-columns: 1fr; }
}

/* Very small phones */
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero__actions .btn { flex: 1 1 auto; }
}
