/* =====================================================================
   KMU Automation Cloud — design system
   Dark, calm, Swiss. Violet/indigo brand gradient on a deep navy ground,
   generous radii, restrained glow. One token set drives marketing site,
   customer app and the Systemadmin console so nothing drifts apart.
   ===================================================================== */

:root {
  /* Ground */
  --bg:            #0A0913;
  --bg-alt:        #0E0D1B;
  --surface:       #15142A;
  --surface-2:     #1B1A33;
  --surface-3:     #22203E;
  --surface-hover: #24223F;

  /* Lines */
  --line:          rgba(255, 255, 255, 0.075);
  --line-strong:   rgba(255, 255, 255, 0.14);
  --line-brand:    rgba(139, 92, 246, 0.42);

  /* Type */
  --text:          #F2F1F9;
  --text-muted:    #A5A2C4;
  --text-faint:    #74719B;
  --text-inverse:  #14132A;

  /* Brand */
  --brand:         #8B5CF6;
  --brand-strong:  #7C3AED;
  --brand-soft:    #A78BFA;
  --brand-blue:    #5B7CFA;
  --brand-pink:    #C084FC;
  --brand-grad:    linear-gradient(135deg, #5B7CFA 0%, #8B5CF6 52%, #C084FC 100%);
  --brand-grad-sm: linear-gradient(135deg, #7C5CFC 0%, #A855F7 100%);
  --brand-tint:    rgba(139, 92, 246, 0.13);
  --brand-tint-2:  rgba(139, 92, 246, 0.24);

  /* Status */
  --ok:            #34D399;
  --ok-tint:       rgba(52, 211, 153, 0.14);
  --warn:          #FBBF24;
  --warn-tint:     rgba(251, 191, 36, 0.14);
  --danger:        #F87171;
  --danger-tint:   rgba(248, 113, 113, 0.14);
  --info:          #56CCF2;
  --info-tint:     rgba(86, 204, 242, 0.14);
  --neutral-tint:  rgba(255, 255, 255, 0.07);

  /* Shape */
  --r-xs: 6px;  --r-sm: 9px;  --r-md: 13px;  --r-lg: 18px;  --r-xl: 26px;  --r-full: 999px;

  /* Depth */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow:    0 8px 24px -8px rgba(0,0,0,.55);
  --shadow-lg: 0 26px 60px -22px rgba(0,0,0,.75);
  --glow:      0 0 0 1px rgba(139,92,246,.28), 0 16px 44px -18px rgba(139,92,246,.55);

  /* Metrics */
  --sidebar-w: 254px;
  --topbar-h: 62px;
  --maxw: 1240px;
  --maxw-narrow: 780px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: 120ms var(--ease);
  --t: 190ms var(--ease);

  color-scheme: dark;
}

/* --------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.35rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.3rem); letter-spacing: -.03em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; }
p  { margin: 0 0 1em; }
a  { color: var(--brand-soft); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: #C4B5FD; }
small { font-size: .82rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: .87em; }
code {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: .12em .42em; border-radius: var(--r-xs); color: #DDD6FE;
  overflow-wrap: anywhere;
}
pre {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; overflow-x: auto; margin: 0 0 16px;
}
pre code { background: none; border: 0; padding: 0; }
::selection { background: var(--brand-tint-2); color: #fff; }

:focus-visible {
  outline: 2px solid var(--brand-soft);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 999;
  background: var(--brand); color: #fff; padding: 10px 18px; border-radius: var(--r-sm);
  font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full);
  border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #322F55; background-clip: padding-box; }

/* ------------------------------------------------------------ utilities */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.container-narrow { max-width: var(--maxw-narrow); }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); }
.text-danger { color: var(--danger); } .text-brand { color: var(--brand-soft); }
.text-center { text-align: center; } .text-right { text-align: right; }
.text-sm { font-size: .875rem; } .text-xs { font-size: .78rem; }
.text-lg { font-size: 1.06rem; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { overflow-wrap: anywhere; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 26px; }
.mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 26px; }
.mb-4 { margin-bottom: 40px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.gradient-text {
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.divider { height: 1px; background: var(--line); margin: 22px 0; }

/* ---------------------------------------------------------------- grid */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
@media (max-width: 1000px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* -------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm);
  font: inherit; font-size: .93rem; font-weight: 600; line-height: 1.2;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn:hover { background: var(--surface-hover); color: var(--btn-fg); border-color: var(--line-brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn-primary {
  --btn-bg: var(--brand-grad-sm); --btn-fg: #fff; --btn-bd: transparent;
  box-shadow: 0 10px 26px -12px rgba(139, 92, 246, .85);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #8B6BFF 0%, #B266FF 100%);
  border-color: transparent; box-shadow: 0 14px 32px -12px rgba(139, 92, 246, .95);
}
.btn-ghost { --btn-bg: transparent; --btn-bd: var(--line-strong); }
.btn-quiet { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-muted); }
.btn-quiet:hover { --btn-fg: var(--text); background: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger-tint); --btn-fg: #FCA5A5; --btn-bd: rgba(248,113,113,.32); }
.btn-danger:hover { --btn-bg: rgba(248,113,113,.2); border-color: rgba(248,113,113,.5); }
.btn-ok { --btn-bg: var(--ok-tint); --btn-fg: #6EE7B7; --btn-bd: rgba(52,211,153,.32); }
.btn-ok:hover { --btn-bg: rgba(52,211,153,.2); border-color: rgba(52,211,153,.5); }
.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: var(--r-md); }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: var(--r-xs); }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  position: relative;
}
.card-flush { padding: 0; overflow: hidden; }
.card-hover { transition: border-color var(--t), transform var(--t), box-shadow var(--t); }
.card-hover:hover {
  border-color: var(--line-brand); transform: translateY(-2px); box-shadow: var(--shadow-lg);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1.02rem; }
.card-body { padding: 20px 22px; }
.card-foot {
  padding: 14px 22px; border-top: 1px solid var(--line); background: rgba(0,0,0,.16);
  display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.card-glow { box-shadow: var(--glow); border-color: var(--line-brand); }
.card-title { font-size: 1.02rem; font-weight: 700; margin: 0 0 4px; }
.card-sub { color: var(--text-muted); font-size: .875rem; margin: 0; }

/* ----------------------------------------------------------- stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 3px;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--brand-grad); opacity: .85;
}
.stat-value { font-size: 1.95rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: .82rem; }
.stat-hint { color: var(--text-faint); font-size: .74rem; }
.stat-ok::after   { background: linear-gradient(180deg, #34D399, #10B981); }
.stat-warn::after { background: linear-gradient(180deg, #FBBF24, #F59E0B); }
.stat-danger::after { background: linear-gradient(180deg, #F87171, #EF4444); }
.stat-info::after { background: linear-gradient(180deg, #56CCF2, #3B82F6); }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  background: var(--neutral-tint); color: var(--text-muted);
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok      { background: var(--ok-tint);      color: #6EE7B7; border-color: rgba(52,211,153,.24); }
.badge-warn    { background: var(--warn-tint);    color: #FCD34D; border-color: rgba(251,191,36,.24); }
.badge-danger  { background: var(--danger-tint);  color: #FCA5A5; border-color: rgba(248,113,113,.24); }
.badge-info    { background: var(--info-tint);    color: #7DD3FC; border-color: rgba(86,204,242,.24); }
.badge-brand   { background: var(--brand-tint);   color: var(--brand-soft); border-color: var(--line-brand); }
.badge-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}
.badge-lg { padding: 5px 13px; font-size: .8rem; }
.count-badge {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--brand); color: #fff; font-size: .68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.count-badge-danger { background: #EF4444; }
.count-badge-quiet { background: var(--surface-3); color: var(--text-muted); }

/* --------------------------------------------------------------- alerts */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  font-size: .9rem;
}
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert p:last-child { margin-bottom: 0; }
.alert-ok      { background: var(--ok-tint);     border-color: rgba(52,211,153,.3);  color: #A7F3D0; }
.alert-warn    { background: var(--warn-tint);   border-color: rgba(251,191,36,.3);  color: #FDE68A; }
.alert-danger  { background: var(--danger-tint); border-color: rgba(248,113,113,.3); color: #FECACA; }
.alert-info    { background: var(--info-tint);   border-color: rgba(86,204,242,.3);  color: #BAE6FD; }
.alert-brand   { background: var(--brand-tint);  border-color: var(--line-brand);    color: #DDD6FE; }
.alert a { text-decoration: underline; }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 17px; }
.field:last-child { margin-bottom: 0; }
.label {
  display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; color: var(--text);
}
.label .req { color: var(--danger); margin-left: 2px; }
.hint { font-size: .78rem; color: var(--text-faint); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 13px;
  background: var(--bg-alt); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font: inherit; font-size: .92rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(255,255,255,.22); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint); background: var(--bg);
}
.input:disabled, .select:disabled, .textarea:disabled {
  opacity: .55; cursor: not-allowed; background: var(--surface-2);
}
.textarea { min-height: 108px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A5A2C4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-error, .select-error, .textarea-error {
  border-color: rgba(248,113,113,.65); box-shadow: 0 0 0 3px var(--danger-tint);
}
.field-error { color: #FCA5A5; font-size: .8rem; margin-top: 5px; }
.input-sm { padding: 7px 10px; font-size: .85rem; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > * { flex: 1 1 190px; min-width: 0; }

.check {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  font-size: .9rem; padding: 3px 0;
}
.check input[type="checkbox"], .check input[type="radio"] {
  width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand);
  flex: none; cursor: pointer;
}
.check-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); cursor: pointer; transition: all var(--t-fast);
}
.check-card:hover { border-color: var(--line-brand); background: var(--surface-hover); }
.check-card:has(input:checked) {
  border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 1px var(--brand);
}
.check-card input { margin-top: 2px; accent-color: var(--brand); flex: none; }
.check-card-title { font-weight: 600; font-size: .93rem; }
.check-card-sub { color: var(--text-muted); font-size: .82rem; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 42px; height: 24px; border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--line-strong);
  position: relative; transition: background var(--t), border-color var(--t); flex: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform var(--t);
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch-track { background: var(--ok); border-color: transparent; }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand-soft); outline-offset: 2px; }

fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 700; font-size: .95rem; padding: 0 0 10px; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.table th {
  text-align: left; font-weight: 600; font-size: .76rem; letter-spacing: .045em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: rgba(0,0,0,.14);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: rgba(255,255,255,.028); }
.table tbody tr:last-child td { border-bottom: 0; }
.table a { color: var(--text); font-weight: 600; }
.table a:hover { color: var(--brand-soft); }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- empty state */
.empty {
  text-align: center; padding: 54px 26px; color: var(--text-muted);
}
.empty-icon {
  width: 62px; height: 62px; margin: 0 auto 18px; border-radius: var(--r-lg);
  background: var(--brand-tint); border: 1px solid var(--line-brand);
  display: grid; place-items: center; color: var(--brand-soft);
}
.empty-icon svg { width: 27px; height: 27px; }
.empty h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--text); }
.empty p { max-width: 460px; margin: 0 auto 20px; font-size: .92rem; }

/* ------------------------------------------------------------ progress */
.meter {
  height: 7px; border-radius: var(--r-full); background: var(--surface-3);
  overflow: hidden; position: relative;
}
.meter-fill { height: 100%; border-radius: inherit; background: var(--brand-grad-sm);
  transition: width var(--t); }
.meter-warn .meter-fill { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.meter-danger .meter-fill { background: linear-gradient(90deg, #DC2626, #F87171); }
.meter-ok .meter-fill { background: linear-gradient(90deg, #059669, #34D399); }

/* ----------------------------------------------------------- pagination */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin-top: 22px; }
.pager a, .pager span {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--text-muted); font-size: .86rem; font-weight: 600;
  transition: all var(--t-fast);
}
.pager a:hover { border-color: var(--line-brand); color: var(--text); background: var(--surface-2); }
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .disabled { opacity: .38; }
.pager-info { color: var(--text-faint); font-size: .82rem; text-align: center; margin-top: 10px; }

/* --------------------------------------------------------------- tabs */
.tabs {
  display: flex; gap: 3px; border-bottom: 1px solid var(--line);
  margin-bottom: 22px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 11px 15px; font-size: .89rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; white-space: nowrap; transition: all var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-soft); border-bottom-color: var(--brand); }
.tab .count-badge { margin-left: 6px; }

/* --------------------------------------------------------------- chips */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: var(--r-full); font-size: .8rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text-muted);
  transition: all var(--t-fast); cursor: pointer;
}
.chip:hover { border-color: var(--line-brand); color: var(--text); }
.chip.active { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-soft); }
.tag {
  padding: 2px 9px; border-radius: var(--r-xs); font-size: .74rem;
  background: var(--surface-3); color: var(--text-muted); white-space: nowrap;
}

/* -------------------------------------------------------------- avatars */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--brand-grad-sm); color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  letter-spacing: .01em; text-transform: uppercase;
}
.avatar-sm { width: 26px; height: 26px; font-size: .66rem; }
.avatar-lg { width: 46px; height: 46px; font-size: .98rem; }
.avatar-quiet { background: var(--surface-3); color: var(--text-muted); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* -------------------------------------------------------------- toasts */
.toast-region {
  position: fixed; right: 18px; bottom: 18px; z-index: 400;
  display: flex; flex-direction: column; gap: 10px; max-width: min(400px, calc(100vw - 36px));
}
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg); font-size: .89rem;
  animation: toast-in 220ms var(--ease);
}
.toast-ok     { border-left: 3px solid var(--ok); }
.toast-warn   { border-left: 3px solid var(--warn); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-info   { border-left: 3px solid var(--info); }
.toast-close {
  background: none; border: 0; color: var(--text-faint); cursor: pointer;
  padding: 0 2px; font-size: 1.1rem; line-height: 1;
}
.toast-close:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* -------------------------------------------------------------- dialogs */
dialog.modal {
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); padding: 0;
  max-width: min(560px, calc(100vw - 32px)); width: 100%;
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(4, 3, 12, .74); backdrop-filter: blur(3px); }
dialog.modal-wide { max-width: min(860px, calc(100vw - 32px)); }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { margin: 0 0 4px; }
.modal-body { padding: 16px 22px; }
.modal-foot {
  padding: 16px 22px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

/* ------------------------------------------------------------- dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 214px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 11px; border-radius: var(--r-xs); font-size: .88rem;
  color: var(--text); background: none; border: 0; cursor: pointer; text-align: left;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--surface-hover); color: var(--text); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--text-faint); flex: none; }
.dropdown-item-danger { color: #FCA5A5; }
.dropdown-sep { height: 1px; background: var(--line); margin: 5px 0; }
.dropdown-head {
  padding: 8px 11px 6px; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-faint); font-weight: 700;
}

/* ------------------------------------------------------------- tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%); z-index: 90;
  background: #06050E; color: var(--text); border: 1px solid var(--line-strong);
  padding: 6px 10px; border-radius: var(--r-xs); font-size: .76rem; font-weight: 500;
  white-space: nowrap; pointer-events: none; box-shadow: var(--shadow);
}

/* ------------------------------------------------------- icon rendering */
.icon { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-box {
  width: 38px; height: 38px; border-radius: var(--r-md); flex: none;
  display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-soft);
  border: 1px solid var(--line-brand);
}
.icon-box-lg { width: 48px; height: 48px; border-radius: var(--r-lg); }
.icon-box svg { width: 19px; height: 19px; }
.icon-box-lg svg { width: 23px; height: 23px; }
.icon-ok     { background: var(--ok-tint);     color: #6EE7B7; border-color: rgba(52,211,153,.26); }
.icon-warn   { background: var(--warn-tint);   color: #FCD34D; border-color: rgba(251,191,36,.26); }
.icon-danger { background: var(--danger-tint); color: #FCA5A5; border-color: rgba(248,113,113,.26); }
.icon-info   { background: var(--info-tint);   color: #7DD3FC; border-color: rgba(86,204,242,.26); }
.icon-slate  { background: var(--neutral-tint); color: var(--text-muted); border-color: var(--line); }

/* --------------------------------------------------------------- print */
@media print {
  body { background: #fff; color: #000; }
  .no-print, .sidebar, .topbar, .toast-region { display: none !important; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
