:root {
  --navy: #0e1c3f;
  --blue: #4A69BD;
  --blue-dark: #3B5496;
  --ink: #172033;
  --muted: #5d6b82;
  --line: #e3e8f2;
  --bg: #f4f7fb;
  --card: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 18px 50px rgba(14, 28, 63, 0.12);
  font-family: Poppins, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
a { color: var(--blue); }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 12% 18%, rgba(74, 105, 189, 0.55), transparent 32%),
    radial-gradient(circle at 88% 80%, rgba(74, 105, 189, 0.28), transparent 36%),
    var(--navy);
}
.login-body::before,
.login-body::after {
  content: "";
  position: fixed;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  pointer-events: none;
}
.login-body::before { width: 520px; height: 520px; top: -160px; right: -80px; }
.login-body::after { width: 280px; height: 280px; bottom: -80px; left: -40px; }

.login-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--card);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.login-hero {
  padding: 56px 48px;
  background:
    linear-gradient(160deg, rgba(14, 28, 63, 0.2), rgba(14, 28, 63, 0.55)),
    var(--blue);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 560px;
}
.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}
.login-hero h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
  max-width: 18ch;
  letter-spacing: 0.02em;
}
.tagline {
  margin: 18px 0 0;
  font-size: 20px;
  font-weight: 600;
}
.hero-copy {
  margin: 18px 0 0;
  max-width: 34ch;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
}
.login-panel { padding: 40px 36px 28px; }
.logo { width: min(100%, 320px); height: auto; display: block; margin-bottom: 28px; }
.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: #eef2f8;
  border-radius: 999px;
  margin-bottom: 22px;
}
.segment button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.segment button.is-on { background: white; color: var(--blue); box-shadow: 0 4px 14px rgba(14, 28, 63, 0.08); }
label { display: grid; gap: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
input {
  width: 100%;
  border: 1px solid #d5ddeb;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
}
input:focus { outline: 2px solid rgba(74, 105, 189, 0.35); border-color: var(--blue); }
.password-row { display: flex; gap: 8px; align-items: center; }
.password-row input { flex: 1; }
.form-error { color: var(--danger); margin: 0 0 12px; font-size: 14px; }
.fine { color: var(--muted); font-size: 13px; margin: 18px 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 11px 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary { background: var(--blue); color: white; width: 100%; }
.login-panel .btn-primary { margin-top: 4px; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: white; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--danger); color: white; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.text-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}
.text-btn.danger { color: var(--danger); }
.file-btn input { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand img { width: 168px; height: auto; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions .btn { width: auto; }
.badge {
  background: #e8eefb;
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
body:not(.login-body) { background: var(--bg); }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 28px auto 64px; }
.toolbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; }
.toolbar h1 { margin: 0 0 8px; font-size: 32px; }
.lede, .hint { margin: 0; color: var(--muted); line-height: 1.55; max-width: 62ch; }
.hint { margin-top: 8px; }
.toolbar-actions {
  width: min(100%, 440px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.toolbar-actions .btn { width: 100%; }
.search { grid-column: 1 / -1; margin: 0; min-width: 0; }
.count { color: var(--muted); font-size: 14px; margin: 18px 0 10px; }
.select-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.select-bar .btn { width: auto; }
#delete-all { color: var(--danger); border-color: #f0c7c3; }
#delete-all:hover { color: white; background: var(--danger); border-color: var(--danger); }
.firm-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin: 2px 0 0 4px;
  cursor: pointer;
}
.firm-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--danger);
  cursor: pointer;
}
.firm-list { display: grid; gap: 14px; }
.firm-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(14, 28, 63, 0.04);
}
.firm-head, .page-row, .field-value, .row-actions, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.firm-head h2 { margin: 0; font-size: 18px; }
.fields {
  display: grid;
  grid-template-columns: 1.2fr 0.5fr 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}
.field-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.field-value { justify-content: flex-start; flex-wrap: wrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.secret { letter-spacing: 0.12em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  text-decoration: none;
  color: var(--blue-dark);
  background: #eef3fc;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}
.chip:hover { background: var(--blue); color: white; }
button.chip { border: 0; cursor: pointer; font-family: inherit; }
button.chip:disabled { opacity: 0.55; cursor: wait; }
button.chip { border: 0; cursor: pointer; font-family: inherit; }
button.chip:disabled { opacity: 0.55; cursor: wait; }
.empty, .report {
  background: white;
  border: 1px dashed #c9d4e8;
  border-radius: 16px;
  padding: 22px;
  color: var(--muted);
}
.report { margin-bottom: 14px; }
.report strong { color: var(--ink); }
.report p { margin: 8px 0 0; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
dialog {
  border: 0;
  border-radius: 20px;
  padding: 22px;
  width: min(560px, calc(100% - 28px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(14, 28, 63, 0.48); }
dialog h2 { margin: 0 0 16px; }
.warn-copy { margin: 0 0 16px; line-height: 1.55; color: var(--ink); }
#pages-dialog { width: min(760px, calc(100% - 28px)); }
.split { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 12px; }
.dialog-actions { justify-content: flex-end; margin-top: 8px; }
.dialog-actions .btn { width: auto; }
.page-list { display: grid; gap: 10px; margin: 8px 0 16px; }
.page-row, .page-edit {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.page-row { align-items: flex-start; }
.page-row small, .page-edit { display: block; color: var(--muted); word-break: break-all; font-weight: 500; }
.page-edit { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; align-items: center; }
.mini {
  margin-left: 8px;
  background: #e8eefb;
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}
.module-board, .incentive-board, .result-board {
  margin: 0 0 24px;
}
.module-board h2, .incentive-board h2, .result-board h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.yersiz-row {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-left: 3px solid #8aa0c8;
  background: #f7f9ff;
}
.firm-row .firm-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.firm-identity {
  min-width: 0;
  flex: 1;
}
.firm-file-name {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--blue);
  word-break: break-word;
}
.firm-sicil {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
  word-break: break-all;
}
.firm-unvan {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.25;
  color: var(--ink);
}
.firm-adres {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: #b42318;
  line-height: 1.35;
}
.firm-adres.is-empty {
  color: var(--muted);
  text-transform: none;
  font-weight: 500;
}
.firm-sgm {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink);
}
.firm-sgm.is-empty {
  color: var(--muted);
}
#captcha-image {
  display: block;
  margin: 12px 0;
  max-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
}
#captcha-code-label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.firm-yersiz {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.yersiz-card-empty {
  padding: 10px 12px;
  border-left: 3px solid #c5d0e6;
  background: #f8fafc;
}
.yersiz-card-empty p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.yersiz-row.is-ok {
  border-left-color: #2f8f5b;
  background: #f3faf6;
}
.yersiz-row.is-bad {
  border-left-color: #c44b4b;
  background: #fff6f6;
}
.yersiz-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.yersiz-row ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}
.module-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(14, 28, 63, 0.05);
}
.module-card p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.module-card small {
  color: var(--blue-dark);
  word-break: break-all;
}
.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.module-card.is-active {
  border-color: #b7c8ef;
  background: #f7f9ff;
}

@media (max-width: 860px) {
  .login-shell, .toolbar, .fields, .page-edit, .split { grid-template-columns: 1fr; display: grid; }
  .login-hero { min-height: 0; padding: 32px 24px; }
  .login-hero h1 { font-size: 22px; max-width: none; }
  .login-panel { padding: 28px 22px; }
  .toolbar-actions, .topbar { align-items: stretch; }
  .topbar { flex-wrap: wrap; }
  .search { min-width: 0; }
  .hub-grid { grid-template-columns: 1fr; }
}

.hub-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(74, 105, 189, 0.18), transparent 28%),
    var(--bg);
}
.hub-top { background: #fff; }
.hub {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.hub h1 {
  margin: 0 0 28px;
  font-size: 28px;
}
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.hub-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 320px;
  padding: 36px;
  border-radius: 28px;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.hub-card strong {
  font-size: 42px;
  letter-spacing: 0.04em;
  line-height: 1.05;
}
.hub-card p {
  margin: 12px 0 0;
  font-size: 18px;
}
.hub-sgk {
  background: #fff;
  color: var(--navy);
  border: 1px solid #d5deee;
}
.hub-sgk p { color: var(--muted); }
.hub-kosgeb {
  background: linear-gradient(160deg, #4A69BD 0%, #243e86 100%);
  color: #fff;
}
.hub-kosgeb p { color: rgba(255,255,255,0.88); }
.hub-solo { max-width: 640px; }
.hub-product {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.k-agents { max-width: 360px; margin: 18px 0 0; }
.k-scan {
  margin: 22px 0 0;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid #c9d4e8;
  border-left: 4px solid var(--blue);
  border-radius: 16px;
}
.k-scan[data-status="waiting"] { border-left-color: #b54708; background: #fffaeb; }
.k-scan[data-status="done"] { border-left-color: var(--ok); }
.k-scan[data-status="error"], .k-scan[data-status="stopped"] { border-left-color: var(--danger); }
.k-scan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.k-scan-head .btn { width: auto; }
.k-bar { height: 6px; margin: 12px 0 8px; background: #eef2f8; border-radius: 999px; overflow: hidden; }
.k-bar span { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.3s; }
.k-scan-step { margin: 0; color: var(--muted); font-size: 14px; }
.k-firm.is-scanning { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.18); }
.k-firm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.k-firm-id { min-width: 0; }
.k-firm-id h2 { margin: 0 0 4px; font-size: 18px; word-break: break-word; }
.k-tax { color: var(--muted); font-size: 14px; }
.k-firm-actions { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.k-firm-actions .btn { width: auto; padding: 9px 18px; }
.k-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border-left: 3px solid #8aa0c8;
  background: #f7f9ff;
}
.k-result.is-none { color: var(--muted); font-size: 14px; border-left-color: var(--line); background: #fafbfd; }
.k-result.is-approved { border-left-color: var(--ok); background: #ecfdf3; }
.k-result.is-no_power { border-left-color: var(--danger); background: #fef3f2; }
.k-result.is-error { border-left-color: #b54708; background: #fffaeb; }
.k-headline { margin: 6px 0 0; font-weight: 600; line-height: 1.45; white-space: pre-wrap; }
.k-result.is-approved .k-headline { color: var(--ok); }
.k-result.is-no_power .k-headline { color: var(--danger); font-weight: 800; }
.k-result small { display: block; margin-top: 8px; color: var(--muted); }
.k-kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e8eefb;
  color: var(--blue-dark);
}
.is-approved .k-kind { background: #d1fadf; color: var(--ok); }
.is-no_power .k-kind { background: #fee4e2; color: var(--danger); }
.is-error .k-kind { background: #fef0c7; color: #93370d; }
.k-rows { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.k-rows li { display: flex; flex-wrap: wrap; gap: 10px; }
.k-screen { margin-top: 8px; font-size: 13px; }
.k-screen summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.k-screen pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  font-family: inherit;
}
.k-results { margin-top: 32px; }
.k-results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.k-results-head h2 { margin: 0; }
.k-results-head .btn { width: auto; }
.k-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.k-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.k-table th, .k-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.k-table th { color: var(--muted); font-size: 12px; font-weight: 600; background: #fafbfd; }
.k-table tbody tr:last-child td { border-bottom: 0; }
.k-table tr.is-approved td:nth-child(3) { color: var(--ok); font-weight: 600; }
.k-table tr.is-no_power td:nth-child(3) { color: var(--danger); font-weight: 700; }
.k-table tr.is-none td:nth-child(3) { color: var(--muted); }
@media (max-width: 760px) {
  .k-firm-head { flex-direction: column; }
}
