/* =====================================================================
   vohost — component library
   ===================================================================== */

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app.collapsed { grid-template-columns: 64px 1fr; }

.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.sidebar .brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; }
.app.collapsed .brand-name { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { margin-bottom: 4px; }
.nav-group-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--faint); padding: 14px 10px 6px;
}
.app.collapsed .nav-group-label { opacity: 0; height: 10px; padding: 6px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r);
  color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap; position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-weak); color: var(--text); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.app.collapsed .nav-item .label { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 8px; }

/* ---------- Topbar ---------- */
.content { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r); border: 1px solid transparent; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: .12s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r); padding: 7px 12px; color: var(--muted);
}
.search input { border: none; background: transparent; color: var(--text); outline: none; width: 100%; font-size: 13px; }
.search svg { width: 16px; height: 16px; }
.search kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.spacer { flex: 1; }

/* ---------- Main ---------- */
.main { padding: 24px 28px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 20px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; margin-bottom: 10px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs svg { width: 13px; height: 13px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); cursor: pointer;
  transition: .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }
.card-head .sub { font-size: 12px; color: var(--muted); }

/* ---------- Metric cards ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.metric .top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 500; }
.metric .ic { width: 30px; height: 30px; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; color: var(--accent-2); }
.metric .ic svg { width: 16px; height: 16px; }
.metric .val { font-size: 26px; font-weight: 650; margin-top: 10px; letter-spacing: -0.02em; }
.metric .desc { font-size: 12px; color: var(--faint); margin-top: 4px; }
.delta { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 20px; }
.delta.up { color: var(--success); background: var(--success-weak); }
.delta.down { color: var(--danger); background: var(--danger-weak); }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.mt { margin-top: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--card);
}
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); color: var(--text); white-space: nowrap; }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .muted { color: var(--muted); }
.cell-main { font-weight: 550; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; border: 1px solid transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--success); background: var(--success-weak); }
.badge.warn { color: var(--warning); background: var(--warning-weak); }
.badge.err { color: var(--danger); background: var(--danger-weak); }
.badge.info { color: var(--info); background: var(--info-weak); }
.badge.neutral { color: var(--muted); background: var(--bg-2); }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--bg-2); border-radius: 20px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 20px; }
.progress.ok > span { background: var(--success); }
.progress.warn > span { background: var(--warning); }
.progress.err > span { background: var(--danger); }
.usage-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 550; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Segmented ---------- */
.segmented { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r); padding: 3px; gap: 2px; }
.segmented button { border: none; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.segmented button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 13px; font-family: inherit; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.hint { font-size: 12px; color: var(--faint); margin-top: 6px; }
.field-err { font-size: 12px; color: var(--danger); margin-top: 6px; display: none; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(2,6,15,0.6); backdrop-filter: blur(2px); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal-overlay.open { display: grid; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); animation: pop .14s ease; }
.modal.lg { max-width: 720px; }
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--r); padding: 12px 14px; min-width: 260px; box-shadow: var(--shadow-lg);
  font-size: 13px; animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateX(16px); opacity: 0; } }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast svg { width: 18px; height: 18px; }

/* ---------- Dropdown menu ---------- */
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; display: none; z-index: 50;
}
.menu.open .menu-pop { display: block; }
.menu-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.menu-item:hover { background: var(--bg-2); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { width: 15px; height: 15px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- Empty / unavailable ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--faint); }
.empty .ic svg { width: 22px; height: 22px; }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 380px; margin: 0 auto; }
.unavailable-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warning); background: var(--warning-weak); padding: 4px 10px; border-radius: 20px; margin-top: 14px; }
.unavailable-note svg { width: 14px; height: 14px; }

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--bg-2) 25%, var(--border-soft) 37%, var(--bg-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }

/* ---------- Wizard ---------- */
.steps { display: flex; gap: 0; margin-bottom: 24px; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-weight: 600; flex-shrink: 0; background: var(--bg-2); }
.step.active .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.done .n { background: var(--success-weak); border-color: var(--success); color: var(--success); }
.step.active { color: var(--text); }
.step .bar { flex: 1; height: 1px; background: var(--border); margin: 0 4px; }
.step:last-child .bar { display: none; }

/* ---------- Pricing cards ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 16px; }
.plan { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; }
.plan.featured { border-color: var(--accent); }
.plan .name { font-size: 14px; font-weight: 600; }
.plan .price { font-size: 30px; font-weight: 650; margin: 10px 0 2px; letter-spacing: -0.02em; }
.plan .price span { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 16px 0; font-size: 13px; color: var(--muted); }
.plan ul li { display: flex; gap: 8px; padding: 5px 0; }
.plan ul li svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; margin-top: 2px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--sidebar); border-right: 1px solid var(--border); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .quote { font-size: 20px; font-weight: 500; line-height: 1.45; letter-spacing: -0.01em; max-width: 420px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.alert { display: none; align-items: center; gap: 8px; font-size: 13px; padding: 10px 12px; border-radius: var(--r); margin-bottom: 16px; }
.alert.show { display: flex; }
.alert.error { color: #fecaca; background: var(--danger-weak); border: 1px solid rgba(239,68,68,0.3); }
.alert svg { width: 16px; height: 16px; }

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
.scrim { display: none; }
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; }
  .menu-toggle { display: grid; }
  .main { padding: 18px 16px; }
  .metrics { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .search .hide-sm { display: none; }
  .page-head { flex-direction: column; }
}
