/* Arnika admin design system.
   Brand: arnika.dev.codingteam.site (Inter Tight, #E30613, #FFDD00, #1C2024).
   Every text colour below is >= 4.5:1 on its background, component borders >= 3:1 (WCAG 2.2 AA). */
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("fonts/InterTight-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  /* brand */
  --red: #E30613;          /* 4.9:1 on white: buttons with white text, accents */
  --red-strong: #B8000F;   /* 6.9:1: red text, hover */
  --red-bg: #FDECEE;
  --yellow: #FFDD00;
  --ink: #1C2024;          /* 16.4:1 */
  /* neutrals */
  --text-2: #4A4F55;       /* 8.3:1 secondary text */
  --text-3: #5F656C;       /* 6.1:1 hints, captions (5.6:1 on --bg) */
  --border-strong: #8A9097;/* 3.2:1 input and control borders */
  --border: #DADDE1;       /* decorative dividers only */
  --bg: #F3F4F6;
  --card: #FFFFFF;
  /* status */
  --green: #1D7A3A; --green-bg: #E6F4EA;
  --amber: #8A5300; --amber-bg: #FFF1D1;
  /* geometry */
  --r-card: 20px; --r-ctl: 12px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .22);
  --focus: 0 0 0 3px #fff, 0 0 0 5px var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 15px/1.5 "Inter Tight", system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red-strong); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 12px; color: #fff; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--border); }
.topbar .in { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 68px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand img { height: 28px; display: block; }
.brand span { font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--text-2); border-left: 1px solid var(--border); padding-left: 12px; }
.gsearch { flex: 1; max-width: 420px; position: relative; }
.gsearch input { height: 42px; padding-left: 42px; padding-right: 44px; }
.gsearch .i { position: absolute; left: 14px; top: 12px; color: var(--text-3); }
.gsearch kbd { position: absolute; right: 10px; top: 10px; }
kbd { font: 600 12px/1 "Inter Tight", sans-serif; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 6px; padding: 3px 7px; background: #fff; }
.user { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.user .who { text-align: right; line-height: 1.25; }
.user .who b { display: block; font-weight: 600; }
.user .who span { color: var(--text-3); font-size: 12px; }
.tabs { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 12px 12px 11px; text-decoration: none;
  color: var(--text-2); font-weight: 500; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }

/* ---------- page ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 680px; }
.page-head .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.crumbs a { color: var(--text-2); }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 14px; font-weight: 500; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 24px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .section-head { padding: 20px 20px 0; }
.card.yellow { background: var(--yellow); border-color: #E6C700; }
.card h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.card .lead { margin: 0 0 18px; color: var(--text-2); }
.card.yellow .lead { color: #2D2A00; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.grid-card { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .grid-2, .grid-main, .grid-card { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; align-content: start; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.id { font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.kpi .label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.green { background: #22A04B; } .dot.red { background: var(--red); } .dot.amber { background: #E39B00; } .dot.ink { background: var(--ink); }

/* ---------- capacity ---------- */
.cap-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cap-value { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cap-sub { color: var(--text-2); margin-top: 8px; }
.meter { position: relative; height: 14px; background: #E3E5E8; border-radius: var(--r-pill); margin: 28px 0 34px; }
.meter > i { position: absolute; inset: 0 auto 0 0; background: var(--red); border-radius: var(--r-pill); min-width: 6px; }
.meter .mark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }
.meter .mark span { position: absolute; top: 26px; left: 1px; transform: translateX(-50%); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.cap-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; }
.cap-facts div { font-size: 13px; color: var(--text-2); }
.cap-facts b { display: block; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.active, .badge.ok { background: var(--green-bg); color: var(--green); }
.badge.blocked, .badge.crit { background: var(--red-bg); color: var(--red-strong); }
.badge.replaced, .badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.neutral { background: #ECEEF1; color: var(--text-2); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.field .help { font-size: 13px; color: var(--text-3); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; }
input, select, textarea {
  font: 500 15px/1.4 "Inter Tight", system-ui, sans-serif; color: var(--ink);
  height: 46px; padding: 0 14px; width: 100%;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-ctl);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; }
select { appearance: none; padding-right: 40px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231C2024' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(28, 32, 36, .18); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red-strong); box-shadow: 0 0 0 3px rgba(184, 0, 15, .14); }
input.id-input { font-weight: 600; letter-spacing: .04em; }
input.id-input::placeholder { letter-spacing: 0; font-weight: 500; }
.card.yellow input { border-color: #6B5C00; }

/* live check line under an input */
.live { min-height: 22px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.live.ok { color: var(--green); } .live.err { color: var(--red-strong); } .live.idle { color: var(--text-3); }
.live b { color: var(--ink); letter-spacing: .04em; }

/* segmented control */
.seg { display: inline-flex; background: #E6E8EB; border-radius: var(--r-ctl); padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.seg input:checked + label { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg input:focus-visible + label { box-shadow: var(--focus); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: #fff; font: 500 14px "Inter Tight", sans-serif; color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.word-chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.word-chip.ok { background: var(--green-bg); color: var(--green); }
.word-chip.bad { background: var(--red-bg); color: var(--red-strong); }

/* ---------- buttons ---------- */
.btn {
  font: 600 15px/1 "Inter Tight", system-ui, sans-serif;
  height: 46px; padding: 0 20px; border-radius: var(--r-ctl); border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-strong); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; color: #fff; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn.secondary:hover { border-color: var(--ink); background: #F7F8F9; color: var(--ink); }
.btn.danger { background: #fff; color: var(--red-strong); border-color: var(--red-strong); }
.btn.danger:hover, .btn.danger.solid { background: var(--red-strong); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); padding: 0 12px; }
.btn.ghost:hover { background: #ECEEF1; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin-bottom: 20px; border: 1px solid; font-weight: 500; }
.alert .i { margin-top: 2px; }
.alert.ok { background: var(--green-bg); border-color: #9BD3AE; color: #145A2A; }
.alert.err { background: var(--red-bg); border-color: #F2A7AE; color: #8F000C; }
.alert.warn { background: var(--amber-bg); border-color: #EBC46B; color: #6B4000; }
.alert .grow { flex: 1; }
.alert a { color: inherit; font-weight: 600; }
.alert button.close { background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; border-radius: 6px; display: flex; }

/* ---------- tables ---------- */
.table-tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-tools .field { flex: 0 1 320px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 14px; }
thead th { background: #F7F8F9; font-size: 13px; font-weight: 600; color: var(--text-2); }
tbody tr:hover { background: #FAFAFB; }
tbody tr:last-child td { border-bottom: 0; }
td .sub { display: block; font-size: 13px; color: var(--text-3); }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* definition list */
dl.props { display: grid; grid-template-columns: 180px 1fr; margin: 0; }
dl.props dt, dl.props dd { padding: 12px 0; border-bottom: 1px solid var(--border); margin: 0; }
dl.props dt { color: var(--text-2); font-size: 14px; font-weight: 500; }
dl.props dd { font-weight: 500; }
dl.props > :nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- card page ---------- */
.id-hero { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.id-hero .big { font-size: 34px; font-weight: 700; letter-spacing: .03em; line-height: 1.1; }
.plastic {
  aspect-ratio: 85.6 / 54; border-radius: 16px; padding: 16px 18px; position: relative; overflow: hidden;
  background: var(--red); color: #fff; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow-lg);
}
.plastic .logo { height: 20px; filter: brightness(0) invert(1); align-self: flex-start; }
.plastic small { position: absolute; right: 18px; top: 18px; font-size: 11px; font-weight: 600; }
.plastic .bc { background: #fff; border-radius: 10px; padding: 8px 10px 6px; }
.plastic .bc img { display: block; width: 100%; height: 66px; object-fit: contain; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: -4px; width: 2px; background: var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 6px; width: 10px; height: 10px; }
.timeline b { display: block; font-weight: 600; }
.timeline span { font-size: 13px; color: var(--text-3); }
.danger-zone { border-color: #F2A7AE; }
.danger-zone h3 { color: var(--red-strong); }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0 20px 8px; }
.feed li { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed b { font-weight: 600; }
.feed .meta { display: block; font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.feed time { font-size: 13px; color: var(--text-3); white-space: nowrap; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog::backdrop { background: rgba(16, 20, 24, .55); }
dialog form { padding: 24px; display: grid; gap: 16px; }
dialog h3 { margin: 0; font-size: 20px; }
dialog p { margin: 0; color: var(--text-2); }
dialog .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 500; transition: .2s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--border); border-radius: 24px; padding: 36px; box-shadow: var(--shadow-lg); }
.login img { height: 34px; margin-bottom: 28px; }
.login h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; }
.login p { margin: 0; color: var(--text-2); }
.login form { display: grid; gap: 16px; margin-top: 24px; }

@media (max-width: 720px) {
  .topbar .in { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .gsearch { order: 3; max-width: none; flex-basis: 100%; }
  .gsearch kbd, .brand span { display: none; }
  main { padding: 20px 16px 64px; }
  .page-head h1 { font-size: 26px; }
  dl.props { grid-template-columns: 1fr; }
  dl.props dt { border-bottom: 0; padding-bottom: 0; }
  th, td { padding: 12px 14px; }
  .cap-facts { grid-template-columns: 1fr; }
}
