/* Artlas Console. Layout, tokens and components follow the Quiire admin console. */

:root {
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --foreground: #111111;
  --muted-foreground: #5f6368;
  --border: #e6e7ea;
  --primary: #ff5f1f;
  --primary-hover: #e64f10;
  --primary-foreground: #ffffff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0ea5e9;
  --ring: #ff5f1f;
  --font-sans: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sidebar-width: 16rem;
  --header-height: 4rem;
  color-scheme: light;
}

/* The sidebar is always dark, as in Quiire. */
.dark, .sidebar {
  --background: #000000;
  --surface: #0e0e0e;
  --surface-muted: #171717;
  --foreground: #f4f4f5;
  --muted-foreground: #8e8e93;
  --border: #262626;
  --primary-hover: #ff7a45;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
}
html.dark { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--background); color: var(--foreground);
  font: 14px/20px var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--font-mono); font-size: 12px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted-foreground); }
.small { font-size: 12px; line-height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100dvh; }
.sidebar-rail { flex: 0 0 var(--sidebar-width); width: var(--sidebar-width); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width);
  display: flex; flex-direction: column; background: var(--surface); color: var(--foreground);
  border-right: 1px solid var(--border); overflow: hidden;
}
.sidebar-brand { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 24px; flex: none; }
.sidebar-brand img { height: 22px; width: auto; display: block; }
.sidebar-brand span { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); padding-top: 3px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 24px; display: grid; align-content: start; gap: 24px; }
.nav-section { display: grid; gap: 4px; }
.nav-heading {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 4px 12px 8px; border: 0; background: none; cursor: pointer; border-radius: 6px;
  font: 600 12px/16px var(--font-sans); letter-spacing: .05em; text-transform: uppercase;
  color: color-mix(in oklab, var(--muted-foreground) 70%, transparent);
}
.nav-heading.current { color: var(--foreground); }
.nav-heading .icon { transition: transform .2s var(--ease); }
.nav-section.closed .nav-heading .icon { transform: rotate(-90deg); }
.nav-section.closed .nav-items { display: none; }
.nav-items { display: grid; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  font-weight: 500; color: var(--muted-foreground); transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-muted); color: var(--foreground); }
.nav-link.active { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.nav-link .badge { margin-left: auto; }
.nav-sub { display: grid; gap: 4px; padding-left: 20px; margin: 4px 0 0; list-style: none; }
.sidebar-user { flex: none; border-top: 1px solid var(--border); padding: 12px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #ff7a45, #ff5f1f); color: #fff; font-weight: 700; font-size: 14px; position: relative;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar .presence { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 2px var(--surface); }
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user .who strong { display: block; font-weight: 600; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none;
  color: var(--muted-foreground); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--foreground); }
.icon-btn.danger:hover { background: color-mix(in oklab, var(--danger) 10%, transparent); color: var(--danger); }
.icon-btn.lg { width: 40px; height: 40px; }

.app-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 30; height: var(--header-height); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 80%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.menu-btn { display: none; }
.header-search { position: relative; width: min(420px, 40vw); }
.header-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); }
.header-search input { padding-left: 36px; padding-right: 44px; height: 40px; background: var(--surface-muted); }
.header-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
kbd { border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font: 500 10px var(--font-sans); color: var(--muted-foreground); background: var(--surface); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.switcher, .menu { position: relative; }
.switcher-btn, .profile-btn {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 4px 10px 4px 4px; border-radius: 8px; border: 0; background: none;
  color: var(--foreground); cursor: pointer; font: 500 14px var(--font-sans); text-align: left;
}
.switcher-btn { border: 1px solid var(--border); padding: 4px 10px; background: var(--surface); }
.switcher-btn:hover, .profile-btn:hover { background: var(--surface-muted); }
.site-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--success); flex: none; }
.site-dot.down { background: var(--danger); }
.site-dot.unknown { background: var(--muted-foreground); }
.profile-btn small, .switcher-btn small { display: block; font-size: 12px; line-height: 14px; color: var(--muted-foreground); font-weight: 400; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 288px; padding: 8px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-2xl);
}
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--muted-foreground); font: 400 14px var(--font-sans); cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-muted); color: var(--foreground); }
.dropdown a.current { color: var(--foreground); font-weight: 600; }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown .head { padding: 8px 10px 10px; }

main.content { flex: 1; padding: 24px; }
.page-header {
  position: sticky; top: var(--header-height); z-index: 20; margin: -24px -24px 24px; padding: 16px 24px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px;
}
.breadcrumbs { display: flex; align-items: center; gap: 4px; min-height: 16px; margin-bottom: 8px; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.breadcrumbs a:hover, .breadcrumbs .last { color: var(--foreground); }
.page-header h1 { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.025em; }
.page-header .desc { margin-top: 4px; max-width: 48rem; color: var(--muted-foreground); line-height: 1.625; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 16px 24px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted-foreground); }
.app-footer .status { display: flex; align-items: center; gap: 8px; }

/* ---------- Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 8px;
  border: 0; font: 500 14px var(--font-sans); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s, transform .15s;
  color: var(--foreground); background: var(--surface-muted);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible, a:focus-visible, button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.btn-outline:hover { background: var(--surface-muted); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { filter: brightness(.9); }
.btn-soft-danger { background: color-mix(in oklab, var(--danger) 10%, transparent); color: var(--danger); }
.btn-soft-danger:hover { background: color-mix(in oklab, var(--danger) 15%, transparent); }
.btn-soft { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.btn-soft:hover { background: color-mix(in oklab, var(--primary) 15%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; gap: 6px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; gap: 4px; }
.btn-lg { height: 44px; padding: 0 24px; }
.btn-block { width: 100%; }

.label { display: block; margin-bottom: 6px; font-weight: 500; }
.label .key { font: 400 11px var(--font-mono); color: var(--muted-foreground); margin-left: 6px; }
.hint { margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.input, .select, .textarea, .rich-area {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--foreground); font: 14px var(--font-sans); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.textarea, .rich-area { height: auto; min-height: 80px; padding: 8px 12px; line-height: 1.625; resize: vertical; }
.rich-area.single { min-height: 40px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible, .rich-area:focus { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in oklab, var(--danger) 30%, transparent); }
.field { display: grid; align-content: start; }
.field + .field { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.counter { font-size: 12px; color: var(--muted-foreground); justify-self: end; margin-top: 4px; }
.counter.over { color: var(--warning); }
.input-group { display: flex; }
.input-group .input { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; box-shadow: inset 0 0 0 1px var(--border); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-header p { font-size: 12px; line-height: 16px; color: var(--muted-foreground); margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 3px 10px; border-radius: 999px; font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; }
.badge-neutral { background: var(--surface-muted); color: var(--muted-foreground); }
.badge-primary { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.badge-success { background: color-mix(in oklab, var(--success) 10%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in oklab, var(--warning) 12%, transparent); color: var(--warning); }
.badge-danger { background: color-mix(in oklab, var(--danger) 10%, transparent); color: var(--danger); }
.badge-info { background: color-mix(in oklab, var(--info) 10%, transparent); color: var(--info); }
.badge-dot { border: 1px solid var(--border); background: var(--surface); color: var(--foreground); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--success); }
.badge-dot.down::before { background: var(--danger); }

.table-frame { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.card .table-frame { border: 0; border-radius: 0; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead tr { height: 48px; background: color-mix(in oklab, var(--surface-muted) 60%, transparent); border-bottom: 1px solid var(--border); }
.table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); white-space: nowrap; }
.table td { padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table tbody tr { height: 56px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover, .table tbody tr:hover { background: var(--surface-muted); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { position: relative; padding: 8px 14px; font-weight: 500; color: var(--muted-foreground); }
.tabs a:hover { color: var(--foreground); }
.tabs a.active { color: var(--primary); }
.tabs a.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-muted); }
.segmented a, .segmented button { padding: 6px 14px; border-radius: 8px; border: 0; background: none; font: 500 14px var(--font-sans); color: var(--muted-foreground); cursor: pointer; }
.segmented .active { background: var(--surface); color: var(--foreground); box-shadow: var(--shadow-sm); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; }
.alert-danger { border-color: color-mix(in oklab, var(--danger) 25%, transparent); background: color-mix(in oklab, var(--danger) 5%, var(--surface)); }
.alert-warning { border-color: color-mix(in oklab, var(--warning) 30%, transparent); background: color-mix(in oklab, var(--warning) 6%, var(--surface)); }
.alert-info { border-color: color-mix(in oklab, var(--info) 25%, transparent); background: color-mix(in oklab, var(--info) 5%, var(--surface)); }
.alert .chip { width: 32px; height: 32px; }
.alert strong { display: block; font-weight: 600; }

.chip { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--surface-muted); color: var(--muted-foreground); }
.chip.primary { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.chip.success { background: color-mix(in oklab, var(--success) 12%, transparent); color: var(--success); }
.chip.warning { background: color-mix(in oklab, var(--warning) 15%, transparent); color: var(--warning); }
.chip.danger { background: color-mix(in oklab, var(--danger) 10%, transparent); color: var(--danger); }
.chip.info { background: color-mix(in oklab, var(--info) 10%, transparent); color: var(--info); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat .value { font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -.025em; }
.stat .label-sm { font-size: 12px; color: var(--muted-foreground); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; border: 1px dashed var(--border); border-radius: 16px; text-align: center; }
.empty .chip { width: 44px; height: 44px; border-radius: 999px; }
.empty h3 { font-size: 14px; font-weight: 600; }
.empty p { max-width: 28rem; color: var(--muted-foreground); }

.toaster { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; width: min(22rem, calc(100vw - 2rem)); display: grid; gap: 8px; pointer-events: none; }
.toast {
  position: relative; display: flex; gap: 12px; padding: 14px 36px 14px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-lg); pointer-events: auto; overflow: hidden;
  animation: toast-in .4s var(--ease);
}
.toast .chip { width: 32px; height: 32px; border-radius: 8px; }
.toast strong { display: block; font-weight: 600; }
.toast p { font-size: 12px; line-height: 16px; color: var(--muted-foreground); margin-top: 2px; }
.toast a { display: inline-block; margin-top: 8px; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.toast .close { position: absolute; right: 6px; top: 6px; }
.toast .bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--success); transform-origin: left; animation: toast-bar 6s linear forwards; }
.toast.danger .bar { background: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
@keyframes toast-bar { to { transform: scaleX(0); } }

/* ---------- Pages ---------- */
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: start; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.sticky-col { position: sticky; top: calc(var(--header-height) + 120px); }

.hero-card { padding: 28px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); margin-bottom: 16px; display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); }
.hero-card h1 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; margin-top: 6px; }
.hero-card p { color: var(--muted-foreground); margin-top: 6px; max-width: 40rem; }

.site-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.site-card { display: flex; flex-direction: column; }
.site-card .card-body { display: grid; gap: 14px; flex: 1; }
.site-card .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.site-card h2 { font-size: 16px; font-weight: 600; }
.site-card .meta { display: grid; gap: 8px; }
.site-card .meta div { display: flex; justify-content: space-between; gap: 12px; }
.site-card .last { padding: 12px; border-radius: 12px; background: var(--surface-muted); }
.site-card .last strong { display: block; font-weight: 500; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick a { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--muted-foreground); transition: border-color .15s, background .15s, color .15s; }
.quick a:hover { border-color: color-mix(in oklab, var(--primary) 40%, transparent); background: color-mix(in oklab, var(--primary) 5%, transparent); color: var(--primary); }

/* Editor */
.editor-fields { min-width: 0; }
.section-card .card-body { display: grid; gap: 18px; }
.section-card .shared { margin-left: 8px; }
.rich { display: grid; }
.rich-tools { display: none; gap: 2px; padding: 4px; border: 1px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--surface-muted); }
.rich:focus-within .rich-tools { display: flex; }
.rich:focus-within .rich-area { border-radius: 0 0 8px 8px; }
.rich-tools button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font: 500 12px var(--font-sans); color: var(--muted-foreground); cursor: pointer; }
.rich-tools button:hover { background: var(--border); color: var(--foreground); }
.rich-area a { color: var(--primary); }
html.js .rich-source { display: none; }
html:not(.js) .rich-area, html:not(.js) .rich-tools { display: none; }
.pair { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.pair label { display: grid; gap: 4px; }
.pair small, .image-controls small { font-size: 12px; color: var(--muted-foreground); }
.image-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: start; }
.thumb { width: 120px; height: 84px; object-fit: cover; border-radius: 10px; background: var(--surface-muted); border: 1px solid var(--border); display: block; }
.image-controls { display: grid; gap: 10px; min-width: 0; }
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.path { font: 11px var(--font-mono); color: var(--muted-foreground); word-break: break-all; }

.list-items { display: grid; gap: 10px; }
.list-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.list-item.dragging { opacity: .5; }
.list-item.drop-target { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 15%, transparent); }
.list-item-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.list-item-head .grip { cursor: grab; color: var(--muted-foreground); display: grid; place-items: center; width: 24px; height: 24px; }
.list-item-head .title { flex: 1; min-width: 0; font-weight: 600; }
.list-item-head .num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-muted); font-size: 12px; font-weight: 600; color: var(--muted-foreground); flex: none; }
.list-item-body { display: grid; gap: 16px; padding: 4px 16px 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.list-item.collapsed .list-item-body { display: none; }
.list-item .chev { transition: transform .2s var(--ease); }
.list-item.collapsed .chev { transform: rotate(-90deg); }
.list-item.is-new { border-color: color-mix(in oklab, var(--primary) 40%, transparent); }

.savebar {
  position: sticky; bottom: 16px; z-index: 15; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 20px; margin-top: 16px;
  border-radius: 16px; border: 1px solid var(--border); background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow-lg);
}
.savebar p { flex: 1; color: var(--muted-foreground); }
.savebar.dirty p { color: var(--foreground); font-weight: 600; }

.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.preview-frame { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: #000; box-shadow: var(--shadow-sm); height: calc(100vh - 260px); min-height: 480px; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* SEO share cards */
.share-previews { display: grid; gap: 16px; }
.share-label { font-size: 12px; font-weight: 600; color: var(--muted-foreground); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.fb-card { border: 1px solid #dadde1; border-radius: 8px; overflow: hidden; background: #fff; color: #050505; font-family: Helvetica, Arial, sans-serif; }
.fb-card .img, .wa-card .img { aspect-ratio: 1.91 / 1; background: #e4e6eb center / cover no-repeat; }
.fb-card .meta { padding: 10px 12px; background: #f0f2f5; border-top: 1px solid #dadde1; }
.fb-card .domain { font-size: 12px; text-transform: uppercase; color: #65676b; }
.fb-card .t { font-size: 16px; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.fb-card .d { font-size: 14px; color: #65676b; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.wa-wrap { background: #efeae2; border-radius: 12px; padding: 16px; }
.wa-card { margin-left: auto; max-width: 340px; background: #d9fdd3; border-radius: 8px; padding: 4px; box-shadow: 0 1px .5px rgba(11,20,26,.13); font-family: -apple-system, Helvetica, Arial, sans-serif; color: #111b21; }
.wa-card .box { background: #cfe9ca; border-radius: 6px; overflow: hidden; }
.wa-card .meta { padding: 8px 10px; }
.wa-card .t { font-size: 14px; font-weight: 600; line-height: 1.3; }
.wa-card .d { font-size: 13px; color: #54656f; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-card .domain { font-size: 12px; color: #54656f; margin-top: 4px; }
.wa-card .link { font-size: 14px; color: #027eb5; padding: 6px 6px 2px; word-break: break-all; }
.wa-card .time { font-size: 11px; color: #667781; text-align: right; padding: 0 6px 2px; }

/* Media */
.media-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.media-item { display: flex; flex-direction: column; }
.media-item .img { aspect-ratio: 4 / 3; background: repeating-conic-gradient(var(--surface-muted) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--border); }
.media-item .img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.media-item .info { padding: 10px 12px; display: grid; gap: 6px; flex: 1; }
.media-item .name { font-weight: 600; font-size: 13px; }
.media-item .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.media-item .acts { display: flex; gap: 4px; padding: 0 8px 8px; flex-wrap: wrap; }
.media-item form { display: inline; }

/* Auth */
body.auth { background: var(--background); }
.auth-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: #000; color: #f4f4f5; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset: auto -20% -40% -20%; height: 80%; background: radial-gradient(closest-side, rgba(255, 95, 31, .35), transparent); pointer-events: none; }
.auth-art img { height: 28px; width: auto; align-self: flex-start; }
.auth-art h2 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; max-width: 26rem; }
.auth-art p { color: #8e8e93; margin-top: 10px; max-width: 26rem; }
.auth-art .sites { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; position: relative; z-index: 1; }
.auth-art .sites span { border: 1px solid #262626; border-radius: 999px; padding: 6px 12px; font-size: 12px; color: #d4d4d8; }
.auth-main { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.025em; }
.auth-card .desc { color: var(--muted-foreground); margin: 6px 0 24px; }
.auth-card form { display: grid; gap: 16px; }
.qr { display: grid; place-items: center; padding: 18px; border-radius: 16px; border: 1px solid var(--border); background: #fff; margin-bottom: 12px; }
.qr svg { width: 180px; height: 180px; }
details.setup-key { font-size: 12px; color: var(--muted-foreground); margin-bottom: 16px; }
details.setup-key code { display: block; margin-top: 8px; padding: 10px; background: var(--surface-muted); border-radius: 8px; color: var(--foreground); word-break: break-all; }
.codes { list-style: none; padding: 14px; margin: 0 0 20px; background: var(--surface-muted); border-radius: 12px; display: grid; grid-template-columns: 1fr; gap: 6px; text-align: center; }
.code-input { font: 600 22px/1 var(--font-mono); letter-spacing: .3em; text-align: center; height: 48px; }
.auth-foot { margin-top: 24px; font-size: 12px; color: var(--muted-foreground); text-align: center; }
.link-btn { border: 0; background: none; color: var(--muted-foreground); font: 500 14px var(--font-sans); cursor: pointer; padding: 6px; }
.link-btn:hover { color: var(--foreground); }

@media (max-width: 1280px) {
  .site-cards { grid-template-columns: 1fr 1fr; }
  .layout-side { grid-template-columns: 1fr; }
}
@media (max-width: 1180px) {
  .layout-2 { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .preview-frame { height: 60vh; }
}
@media (max-width: 1023px) {
  .sidebar-rail { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); z-index: 50; }
  .nav-open .sidebar { transform: none; }
  .nav-open .backdrop { position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / .4); }
  .menu-btn { display: inline-grid; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-cards { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  main.content { padding: 16px; }
  .page-header { margin: -16px -16px 16px; padding: 12px 16px 16px; }
  .app-header { padding: 0 8px; }
  .header-search { display: none; }
  .profile-btn .who, .switcher-btn small { display: none; }
  .grid-2, .grid-3, .pair, .image-row { grid-template-columns: 1fr; }
}

/* Utilities (no inline styles: the CSP allows none) */
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }
.ml-auto { margin-left: auto; }
.chip-sm { width: 32px; height: 32px; border-radius: 8px; }
.col-icon { width: 56px; }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.theme-sun { display: none; }
html.dark .theme-sun { display: block; }
html.dark .theme-moon { display: none; }
.w-full { width: 100%; }
.fw-500 { font-weight: 500; }
.g-title { color: #1a0dab; font-size: 18px; line-height: 1.3; margin: 4px 0; } html.dark .g-title { color: #8ab4f8; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; } .plain-list a { padding: 8px 10px; border-radius: 8px; color: var(--muted-foreground); } .plain-list a:hover { background: var(--surface-muted); color: var(--foreground); }
.chip-xl { width: 56px; height: 56px; border-radius: 16px; }
.mb-16 { margin-bottom: 16px; }
.search-wide { flex: 1; min-width: 240px; }
.select-auto { width: auto; }
.account-card { display: grid; gap: 14px; justify-items: start; }
.account-card .meta { display: grid; gap: 8px; width: 100%; }
.account-card .meta div { display: flex; justify-content: space-between; }
.avatar-xl { width: 64px; height: 64px; font-size: 24px; }
.center-form { display: flex; justify-content: center; margin-top: 8px; } .auth-card form + form { display: flex; justify-content: center; }
.site-cards > .card, .media-grid > .card, .layout-side > .card, .layout-2 > .card { margin-top: 0; }
.site-card .meta div > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-items, .section-card .card-body { grid-template-columns: minmax(0, 1fr); }
.list-item, .list-item-body > * { min-width: 0; }
.layout-2 { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.thumb { background: repeating-conic-gradient(#d4d4d8 0 25%, #a1a1aa 0 50%) 0 0 / 14px 14px; object-fit: contain; }
.site-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.site-card, .site-card .meta div { min-width: 0; }
.grid-2 > .field + .field, .grid-3 > .field + .field { margin-top: 0; }
@media (max-width: 1280px) { .site-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023px) { .site-cards { grid-template-columns: minmax(0, 1fr); } }
.site-card .card-body { grid-template-columns: minmax(0, 1fr); } .site-card .top > div, .site-card .last { min-width: 0; } .site-card .last strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
