:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #10262b;
  --muted: #5d7278;
  --line: #dce6e8;
  --brand: #155f6e;
  --brand-dark: #082a33;
  --brand-soft: #e5f3f4;
  --accent: #f59e0b;
  --danger: #b42318;
  --ok: #067647;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(8, 42, 51, 0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--brand); }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 10% 0%, #dff1f2 0%, transparent 60%),
    radial-gradient(700px 500px at 100% 100%, #e8eef8 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-weight: 800;
  font-size: 22px;
}
.brand-mark.small { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }
.login-card h1 { margin: 18px 0 4px; font-size: 26px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 22px; line-height: 1.5; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21, 95, 110, 0.12); }
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--muted); }
.login-card .btn { width: 100%; margin-top: 18px; padding: 12px; }
.form-error { color: var(--danger); min-height: 18px; font-size: 13px; margin-top: 10px; }
.login-foot { text-align: center; font-size: 11px; margin: 16px 0 0 !important; }

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 26px;
  background: var(--brand-dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.topbar-brand strong { display: block; font-size: 15px; }
.topbar-brand .muted { color: #a9c2c6; font-size: 11px; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab {
  background: transparent;
  border: 0;
  color: #c7dadd;
  padding: 8px 12px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.tab.active, .tab:hover { background: rgba(255,255,255,0.12); color: #fff; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .muted { color: #c7dadd; font-size: 12px; }
.topbar .btn-secondary { background: rgba(255,255,255,0.12); color: #fff; }
.topbar .btn-ghost { color: #c7dadd; }

main { max-width: 1320px; margin: 0 auto; padding: 26px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.page-head p { margin: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.kpi span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi strong { display: block; font-size: 30px; letter-spacing: -0.03em; margin-top: 6px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.product-card h3 { margin: 0 0 12px; font-size: 16px; }
.product-stats { display: flex; gap: 18px; }
.product-stats div span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.product-stats div strong { font-size: 22px; }
.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;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
.service-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.service-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--card-color, var(--brand));
}
.service-card h3 { margin: 0; font-size: 17px; }
.service-card p { margin: 0; color: var(--muted); line-height: 1.45; min-height: 40px; }
.service-meta { display: flex; align-items: baseline; gap: 8px; }
.service-price { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.service-cycle { color: var(--muted); font-size: 12px; }
.service-features { display: flex; flex-wrap: wrap; gap: 6px; }
.service-actions { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.service-actions .btn { flex: 1; min-width: 120px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  background: #eef2f3;
  color: #53666a;
}
.status-pill.active { background: #e7f6ee; color: #067647; }
.status-pill.pending { background: #fff3d6; color: #7a4a00; }
.bundle-card {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 14px 40px rgba(8, 42, 51, 0.22);
}
.bundle-card h3 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.bundle-card p { margin: 0; color: #cfe3e6; max-width: 620px; }
.bundle-price { text-align: right; }
.bundle-price strong { display: block; font-size: 30px; letter-spacing: -0.03em; }
.bundle-price span { color: #cfe3e6; font-size: 12px; }
.bundle-card .btn { background: #fff; color: var(--brand-dark); }
.bundle-badge {
  display: inline-block;
  background: var(--accent);
  color: #3a2500;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 8px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 15px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: #fafcfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td strong { display: block; }
td .sub { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
}
.chip.client { background: #fff3d6; color: #7a4a00; }
.chip.inactive { background: #f1f3f4; color: #6b7478; text-decoration: line-through; }
.chip.role { background: #e8eef8; color: #2b3f66; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-transform: none; letter-spacing: 0; margin: 0; white-space: nowrap; }
.check-label input { width: auto; }
.filters input, .filters select { min-width: 180px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.company-main { max-width: 1200px; margin: 0 auto; padding: 26px; }
.company-nav .tab { background: transparent; color: #c7dadd; border: 0; }
.company-nav .tab.active, .company-nav .tab:hover { background: rgba(255,255,255,0.12); color: #fff; }
.company-form { padding: 20px; }
.company-form .modal-grid { gap: 12px 14px; }
.company-form .modal-actions { margin-top: 18px; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.modal {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  width: min(720px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(8, 42, 51, 0.25);
}
.modal::backdrop { background: rgba(8, 42, 51, 0.45); }
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal p { margin: 0 0 16px; }
.modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.modal-grid label { margin: 0; }
.modal-grid .span-2 { grid-column: span 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--brand-dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 40;
  max-width: 380px;
}
.toast.error { background: var(--danger); }
.status-success { color: var(--ok); font-weight: 700; }
.status-error { color: var(--danger); font-weight: 700; }
.status-skipped, .status-running { color: var(--muted); font-weight: 700; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .topbar-user { margin-left: auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  main { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-user .muted { display: none; }
}
