/* LUKA admin console. Uses only the brand tokens (luka-brand-tokens-v2.0.css)
   plus semantic aliases below; no raw palette values in components. */
:root {
  --c-bg-surface: var(--luka-navy-800);
  --c-bg-elevated: var(--luka-navy-700);
  --c-border: var(--luka-border-dark);
  --c-text: var(--luka-ivory);
  --c-text-muted: var(--luka-metal-400);
  --c-action: var(--luka-ember-500);
  --c-ok: var(--luka-success);
  --c-warn: var(--luka-warning);
  --c-danger: var(--luka-danger);
  --gap: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; }
html { background: var(--luka-navy-900); }
body {
  font-family: var(--luka-font-he);
  font-size: 16px;
  line-height: 1.5;
  background: var(--luka-gradient-page);
  background-attachment: fixed;
  color: var(--c-text);
}
.num, .ltr { font-family: var(--luka-font-en); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 8px; }
a { color: var(--luka-metal-300); }
.muted { color: var(--c-text-muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Shell ---- */
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--c-bg-surface); border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 5;
}
.wordmark { font-family: var(--luka-font-en); font-weight: 700; font-size: 22px; letter-spacing: 2px; }
.wordmark small { font-family: var(--luka-font-he); font-weight: 400; font-size: 14px; letter-spacing: 0; color: var(--c-text-muted); margin-inline-start: 8px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
  color: var(--c-text); text-decoration: none; padding: 10px 14px; border-radius: var(--luka-radius-button);
  min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover { background: var(--c-bg-elevated); }
.nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--c-action); }
.who { color: var(--c-text-muted); font-size: 14px; }
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; margin-bottom: 20px; }

/* ---- Cards ---- */
.luka-card { padding: 20px 22px 24px; }
.card-dark {
  background: var(--c-bg-surface); border: 1px solid var(--c-border);
  border-radius: var(--luka-radius-card); padding: 20px 22px;
}
.grid { display: grid; gap: var(--gap); }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--gap); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
@media (max-width: 720px) { .grid.two { grid-template-columns: 1fr; } main { padding: 16px; } }
.section { margin-bottom: var(--gap); }

.kpi-value { font-family: var(--luka-font-en); font-weight: 700; font-size: 30px; color: var(--luka-metal-text); direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--luka-metal-body); font-size: 14px; }
.kpi-sub { color: var(--luka-metal-body); font-size: 13px; }

/* ---- Status tags (text + symbol, never colour alone) ---- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid currentColor; }
.tag.ok { color: var(--c-ok); }
.tag.warn { color: var(--c-warn); }
.tag.err { color: var(--c-danger); }
.tag.neutral { color: var(--c-text-muted); }
.luka-card .tag { background: rgb(255 255 255 / 55%); }
.luka-card .tag.ok { color: var(--luka-success); }
.luka-card .tag.err { color: var(--luka-danger); }

.alerts { display: grid; gap: 8px; margin-bottom: var(--gap); }
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  background: var(--c-bg-surface); border: 1px solid var(--c-border); border-inline-start: 5px solid var(--c-warn);
}
.alert.error { border-inline-start-color: var(--c-danger); }
.alert .sym { font-weight: 700; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--c-border); vertical-align: top; }
th { color: var(--c-text-muted); font-weight: 700; font-size: 13px; }
tr:hover td { background: rgb(255 255 255 / 2%); }
.luka-card th, .luka-card td { border-bottom-color: rgb(16 32 51 / 15%); }
.luka-card th { color: var(--luka-metal-body); }
.luka-card td { color: var(--luka-metal-text); }
.empty { color: var(--c-text-muted); padding: 12px 0; }

/* ---- Buttons ---- */
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
.luka-button-primary, .luka-button-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.luka-button-primary:hover:not(:disabled) { filter: brightness(1.06); }
.luka-button-secondary:hover:not(:disabled) { background: var(--c-bg-elevated); }
.btn-small { min-height: 40px !important; padding-inline: 14px !important; font-size: 14px; }
/* Destructive: outlined, filled only on hover, so a row of actions stays calm. */
.btn-danger {
  min-height: 36px; padding: 6px 14px; border: 1px solid color-mix(in srgb, var(--c-danger) 70%, transparent);
  border-radius: var(--luka-radius-button); background: transparent; color: var(--c-danger); font-weight: 700; font-size: 14px;
}
.btn-danger:hover:not(:disabled) { background: var(--c-danger); color: #fff; }
.btn-link { background: none; border: 0; color: var(--luka-metal-300); text-decoration: underline; padding: 8px; min-height: 44px; }
/* Actions inside tables and lists: small ghost buttons, not underlined links. */
.btn-ghost, td .btn-link, .check-line .btn-link, .mcp-url .btn-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  background: transparent; border: 1px solid var(--c-border); border-radius: var(--luka-radius-button);
  color: var(--c-text); text-decoration: none; font-size: 14px; font-weight: 600;
}
.btn-ghost:hover, td .btn-link:hover { background: var(--c-bg-elevated); border-color: var(--luka-metal-400); }
td .btn-small { min-height: 36px !important; }
.cell-actions > span, .cell-actions .actions { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* ---- Forms ---- */
.form { display: grid; gap: 14px; max-width: 560px; }
.form.inline { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); max-width: none; align-items: end; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.field .help { font-size: 14px; color: var(--c-text-muted); }
input, select {
  font: inherit; min-height: 48px; padding: 10px 14px; width: 100%;
  background: var(--c-bg-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 12px;
}
input[dir="ltr"] { text-align: left; }
fieldset { border: 1px solid var(--c-border); border-radius: 12px; padding: 12px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.radio { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; margin-inline-end: 18px; }
.radio input { width: 20px; min-height: 20px; }
.form-error { color: #ffb4ad; font-weight: 700; }
.form-error::before { content: "⚠ "; }
.form-ok { color: #8fe0c8; font-weight: 700; }
.form-ok::before { content: "✓ "; }

/* ---- Login ----
   Same card as the LUKA SIGN sign-in (src/components/auth/AuthCard.tsx there):
   icon, title and subtitle; the form; under a line the secure note, the legal
   links and the credit. Uniform across LUKA products (owner, 04.12.2026). */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 384px; padding: 32px; display: grid; gap: 20px; }
.luka-card.login-card:hover { transform: none; filter: none; }
.login-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login-head img { width: 56px; height: 56px; border-radius: 16px; }
.login-head h1 { font-size: 20px; font-weight: 700; margin: 0; color: var(--luka-metal-text); }
.login-head p { font-size: 14px; margin: 0; color: var(--luka-metal-body); }
.login-card .form { gap: 20px; max-width: none; }
.login-card .field { gap: 8px; }
.login-card label, .login-card .field label { color: var(--luka-metal-text); font-size: 14px; font-weight: 500; }
.login-card .help { color: var(--luka-metal-body); font-size: 13px; }
.login-card .form-error { color: var(--luka-danger); font-size: 14px; margin: 0; }
.login-card .form-ok { color: var(--luka-success); font-size: 14px; margin: 0; }
.login-card input {
  min-height: 44px; height: 44px; border-radius: 7px; font-size: 16px;
  background: rgb(255 255 255 / 55%); border: 1px solid var(--luka-tag-border); color: var(--luka-metal-text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}
@media (min-width: 768px) { .login-card input:not(.code-input) { font-size: 14px; } }
.login-card select {
  min-height: 44px; border-radius: 7px; font-size: 16px;
  background: rgb(255 255 255 / 55%); border: 1px solid var(--luka-tag-border); color: var(--luka-metal-text);
}
.login-card strong { color: var(--luka-metal-text); }
.login-card input::placeholder { color: var(--luka-metal-meta); }
.login-card .code-input { height: 48px; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.label-row .link { font-size: 12px; }
.login-card .link, .login-card .btn-link {
  background: none; border: 0; padding: 0; min-height: 0; cursor: pointer; font: inherit;
  color: var(--luka-ember-700); font-weight: 700; text-decoration: none;
}
.login-card .link:hover, .login-card .btn-link:hover { text-decoration: underline; }
.login-card .label-row .link { font-size: 12px; }
.with-icon { position: relative; }
.with-icon .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--luka-metal-body); pointer-events: none; }
.with-icon input { padding-right: 36px; }
.with-icon.has-toggle input { padding-left: 36px; }
.with-icon .toggle {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0;
  padding: 4px; border-radius: 4px; color: var(--luka-metal-body); line-height: 0; cursor: pointer;
}
.with-icon .toggle:hover { color: var(--luka-metal-text); }
.with-icon .toggle svg { width: 16px; height: 16px; }
.login-submit { width: 100%; height: 48px; }
.login-actions { display: grid; gap: 12px; justify-items: center; }
.login-foot { display: grid; gap: 10px; padding-top: 16px; text-align: center; border-top: 1px solid rgb(185 208 223 / 40%); }
.login-foot .secure { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--luka-metal-body); margin: 0; }
.login-foot .secure svg { width: 12px; height: 12px; color: #10b981; }
.legal-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; font-size: 12px; }
.legal-links a { color: #ff8a24 !important; font-weight: 700; text-decoration: none; }
.legal-links a:hover { color: #ffa14d !important; text-decoration: underline; }
.legal-links .dot { opacity: .5; color: #ff8a24; }
.login-foot .credit { font-size: 11px; line-height: 1.35; color: var(--luka-metal-body); opacity: .8; margin: 0; }
.code-input { font-family: var(--luka-font-en); font-size: 26px !important; letter-spacing: 8px; text-align: center !important; }

/* ---- Secret shown once ---- */
.secret-box {
  margin-top: 12px; padding: 14px; border-radius: 12px; border: 2px dashed var(--c-action);
  background: var(--luka-navy-950); word-break: break-all;
}
.secret-box code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; direction: ltr; display: block; text-align: left; }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: 220px; height: 220px; }

.toast {
  position: fixed; inset-inline-start: 24px; bottom: 24px; z-index: 10; max-width: 420px;
  background: var(--c-bg-elevated); border: 1px solid var(--c-border); border-radius: 12px; padding: 12px 16px;
}
.toast.error { border-inline-start: 5px solid var(--c-danger); }
.toast.ok { border-inline-start: 5px solid var(--c-ok); }

/* ---- Audit ---- */
.tech { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; }
.filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.filters .actions { margin-top: 0; }
input[type="date"] { direction: ltr; text-align: right; }
.url-list{margin:.5rem 0;padding-inline-start:1.2rem;display:grid;gap:.25rem}.url-list code{word-break:break-all}
.mcp-url{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.9rem}.mcp-url code{padding:.1rem .4rem;border-radius:4px;background:rgba(255,255,255,.06);word-break:break-all}

/* ---- Layout fixes (04.12.2026) ---- */
.section h3 { margin-top: 22px; }
.form.wide { max-width: none; }
.fields-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); align-items: start; max-width: 720px; }
.edit-box { margin-top: 16px; padding: 16px; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-bg-elevated); max-width: 560px; }
.edit-box h3 { margin-top: 0; }
td.cell-actions .actions { margin-top: 0; flex-wrap: nowrap; justify-content: flex-end; }
td.cell-actions { white-space: nowrap; }
.url-list li { font-size: 14px; }

@media (max-width: 720px) {
  .topbar { gap: 8px 12px; padding: 8px 12px; }
  .wordmark { font-size: 18px; }
  .wordmark small { display: none; }
  .who { display: none; }
  .topbar .luka-button-secondary { margin-inline-start: auto; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 10px; min-height: 36px; white-space: nowrap; font-size: 15px; }
  h1 { font-size: 22px; }
  .card-dark { padding: 14px; }
  .grid.kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 22px; }

  /* Tables become one card per row: label on the right, value on the left. */
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { border: 1px solid var(--c-border); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .table-wrap td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .table-wrap td[data-label]::before { content: attr(data-label); color: var(--c-text-muted); font-size: 13px; font-weight: 700; flex-shrink: 0; }
  .table-wrap td.cell-actions { justify-content: flex-start; white-space: normal; }
  td.cell-actions .actions { flex-wrap: wrap; justify-content: flex-start; }
  tr:hover td { background: none; }
  .url-list { padding-inline-start: 0; list-style: none; }
  .url-list code { font-size: 12px; }
}
details.plans { margin-top: 18px; } details.plans summary { cursor: pointer; color: var(--luka-metal-300); min-height: 44px; display: flex; align-items: center; }

/* Forms check (connection test) and company check summary */
.tag { white-space: nowrap; }
.forms-panel { margin-top: 20px; padding: 20px; border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-bg-elevated); }
.forms-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.forms-head h3 { margin: 0; }
.forms-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.forms-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.forms-reason { margin: 10px 0 0; }
.forms-hint { margin: 12px 0 0; padding: 10px 14px; border-inline-start: 3px solid var(--c-warn); background: rgb(255 255 255 / 4%); border-radius: 6px; }
.forms-panel .table-wrap { margin-top: 14px; }
.forms-panel td { vertical-align: top; }
.form-name { display: grid; gap: 2px; min-width: 150px; }
.form-name code { font-size: 12px; color: var(--c-text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--c-border); white-space: nowrap; }
.small { font-size: 13px; }
.check-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.check-details { margin-top: 6px; font-size: 13px; }
.check-details > div { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.check-details summary { cursor: pointer; color: var(--c-text-muted); }
@media (max-width: 720px) {
  .forms-panel { padding: 14px; }
  .forms-panel .table-wrap td { align-items: flex-start; }
  .form-name { min-width: 0; text-align: end; }
}

/* ---- Polish (2026-12-04) ---- */
main:focus, main:focus-visible { outline: none; }        /* focused only to move screen readers, not a visible frame */
.luka-button-primary { box-shadow: 0 4px 14px rgb(232 93 4 / 22%) !important; }
.luka-button-primary:hover, .luka-button-secondary:hover { transform: none !important; }
.page-head { margin-bottom: 10px; }
.page-head h1 { margin: 0; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 18px; font-size: 14px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 10px 16px; color: var(--c-text-muted); text-decoration: none; white-space: nowrap; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--c-text); }
.tabs a[aria-current="page"] { color: var(--c-text); border-bottom-color: var(--c-action); }
.card-dark h2 { margin-bottom: 14px; }
.card-dark h3 { margin-top: 18px; }
@media (min-width: 721px) { th { white-space: nowrap; } }
.grid > * { min-width: 0; }   /* a wide table must not push a grid card past the screen */
td { vertical-align: middle; }
.open-form { margin-top: 4px; }
@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .card-dark { padding: 16px; }
  .tabs a { padding: 10px 12px; }
}
