:root {
  color-scheme: light;
  --ink: #25343e;
  --ink-soft: #607079;
  --green: #78b63f;
  --green-dark: #4f8f18;
  --green-pale: #eef7e2;
  --surface: #ffffff;
  --surface-muted: #f2f1ed;
  --line: #dfddd5;
  --danger: #a63d3d;
  --danger-pale: #fff0ef;
  --warning: #9a6515;
  --warning-pale: #fff6dc;
  --shadow: 0 24px 70px rgba(37, 52, 62, 0.12);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f5f4f0; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(120, 182, 63, 0.14), transparent 33rem),
    linear-gradient(145deg, #fafaf7 0%, #efeee9 100%);
}
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px clamp(22px, 5vw, 76px);
  border-bottom: 1px solid rgba(37, 52, 62, 0.08);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
}
.brand img { display: block; width: min(270px, 45vw); height: auto; }
.header-meta { display: flex; align-items: center; gap: 14px; }
.admin-label {
  padding: 8px 12px;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}
.quiet-link { color: var(--ink-soft); font-size: 0.86rem; font-weight: 700; text-decoration: none; }
.quiet-link:hover, .quiet-link:focus-visible { color: var(--green-dark); }

main { width: min(1380px, calc(100% - 40px)); margin: 0 auto; }
.login-layout {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.72fr);
  gap: clamp(42px, 8vw, 120px);
  align-items: center;
  padding: clamp(60px, 9vw, 120px) 0;
}
.login-intro { max-width: 760px; }
.eyebrow, .panel-kicker {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.login-intro h1, .dashboard-top h1 {
  margin: 0;
  font-size: clamp(3rem, 6vw, 6.5rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}
.login-intro h1 span { color: var(--green-dark); }
.login-intro > p:last-child {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.panel {
  border: 1px solid rgba(37, 52, 62, 0.09);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}
.login-panel { padding: clamp(25px, 4vw, 44px); }
.panel-heading, .customers-heading, .dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.panel-heading { margin-bottom: 28px; }
.panel-heading h2, .customers-heading h2, .dialog-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  letter-spacing: -0.04em;
}
.security-badge {
  padding: 7px 10px;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 800;
  white-space: nowrap;
}

form { display: grid; gap: 20px; }
label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 0.87rem; font-weight: 750; }
input, select, textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid #cfcdc6;
  border-radius: 12px;
  outline: none;
  background: #fbfbf9;
}
input, select { min-height: 50px; padding: 0 15px; }
textarea { padding: 13px 15px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(120, 182, 63, 0.16);
}
.password-control { position: relative; width: 100%; }
.password-control input { padding-right: 54px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.password-toggle:hover,
.password-toggle:focus-visible,
.password-toggle[aria-pressed="true"] {
  color: var(--green-dark);
  background: var(--green-pale);
}
.password-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.eye-icon {
  position: relative;
  width: 19px;
  height: 13px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 75% 15%;
  transform: rotate(45deg);
}
.eye-icon::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.password-toggle[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  width: 25px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-45deg);
}
input:disabled, select:disabled, textarea:disabled { color: #8d969a; background: #eae9e4; }
label small { color: #7a878d; font-weight: 500; line-height: 1.4; }

.primary-button, .secondary-button, .manage-button, .release-button, .close-button, .text-button,
.delete-account-button, .danger-button {
  border-radius: 12px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
.primary-button {
  min-height: 48px;
  padding: 0 19px;
  color: #fff;
  border: 0;
  background: var(--green-dark);
  box-shadow: 0 11px 23px rgba(79, 143, 24, 0.22);
}
.primary-button:hover, .primary-button:focus-visible { background: #427b12; transform: translateY(-1px); }
.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}
.secondary-button:hover, .secondary-button:focus-visible { border-color: var(--green); color: var(--green-dark); }
button:disabled { cursor: wait; opacity: 0.58; transform: none !important; }
.privacy-note {
  margin: 17px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}
.code-form { gap: 16px; }
.code-explanation { margin: 0 0 2px; color: var(--ink-soft); line-height: 1.55; }
.code-explanation strong { color: var(--ink); }
.code-input {
  text-align: center;
  font-size: 1.55rem;
  font-weight: 850;
  letter-spacing: 0.34em;
  font-variant-numeric: tabular-nums;
}
.text-button {
  padding: 5px;
  color: var(--ink-soft);
  border: 0;
  background: transparent;
}
.text-button:hover, .text-button:focus-visible { color: var(--green-dark); }
.form-status, .dashboard-status { min-height: 1.35em; margin: 0; color: var(--ink-soft); }
.form-status.is-error, .dashboard-status.is-error { color: var(--danger); }

.dashboard { padding: clamp(50px, 7vw, 88px) 0 75px; }
.dashboard-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
}
.dashboard-top h1 { font-size: clamp(3.2rem, 6vw, 6rem); }
.welcome { margin: 15px 0 0; color: var(--ink-soft); }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  min-height: 156px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid rgba(37, 52, 62, 0.09);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 15px 40px rgba(37, 52, 62, 0.07);
}
.stat-card > span { color: var(--ink-soft); font-size: 0.84rem; font-weight: 750; }
.stat-card strong { margin: auto 0 3px; font-size: 2.65rem; line-height: 1; letter-spacing: -0.05em; }
.stat-card small { color: var(--ink-soft); }
.attention-card { background: linear-gradient(145deg, #fff 20%, var(--warning-pale)); }

.maintenance-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
  padding: clamp(22px, 3vw, 30px);
  box-shadow: 0 18px 55px rgba(37, 52, 62, 0.07);
}
.maintenance-copy h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  letter-spacing: -0.035em;
}
.maintenance-copy > p:not(.panel-kicker) {
  margin: 9px 0 5px;
  color: var(--ink);
  font-weight: 750;
}
.maintenance-copy small {
  color: var(--ink-soft);
  line-height: 1.45;
}
.update-protection-button { flex: 0 0 auto; }

.customers-panel { padding: clamp(22px, 3vw, 34px); box-shadow: 0 18px 55px rgba(37, 52, 62, 0.09); }
.customers-heading { align-items: center; margin-bottom: 24px; }
.search-field { width: min(370px, 42vw); }
.search-field input { padding-left: 17px; }
.table-shell { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 14px;
  color: var(--ink-soft);
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
td { padding: 18px 14px; border-bottom: 1px solid #eceae4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfbf8; }
.customer-name { display: block; font-weight: 800; }
.customer-email, .cell-meta { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 0.78rem; }
.cell-meta .pill { margin-right: 7px; }
.pill {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-pale);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: capitalize;
}
.pill.is-blocked, .pill.is-suspended, .pill.is-cancelled, .pill.is-expired {
  color: var(--danger);
  background: var(--danger-pale);
}
.pill.is-admin { margin-left: 5px; color: #35577a; background: #e9f0f8; }
.pill.is-trial, .pill.is-pending_email, .pill.is-ready, .pill.is-started {
  margin-left: 5px;
  color: #6b5218;
  background: #fff3d6;
}
.manage-button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}
.manage-button:hover, .manage-button:focus-visible { color: var(--green-dark); border-color: var(--green); }
.empty-state { padding: 42px 20px; color: var(--ink-soft); text-align: center; }
.dashboard-status { margin-top: 18px; }

.editor-dialog {
  width: min(900px, calc(100% - 30px));
  max-height: min(900px, calc(100vh - 30px));
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 35px 110px rgba(24, 35, 42, 0.34);
}
.editor-dialog::backdrop { background: rgba(25, 36, 43, 0.62); backdrop-filter: blur(5px); }
.editor-dialog > form { display: block; padding: clamp(23px, 4vw, 42px); }
.dialog-heading { align-items: center; margin-bottom: 28px; }
.close-button {
  width: 42px;
  height: 42px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  font-size: 1.5rem;
  line-height: 1;
}
.form-section { padding: 26px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.section-heading > span {
  flex: 0 0 auto;
  min-width: 36px;
  padding: 7px 0;
  color: var(--green-dark);
  border-radius: 9px;
  background: var(--green-pale);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 850;
}
.section-heading h3 { margin: 1px 0 4px; font-size: 1.17rem; }
.section-heading p { margin: 0; color: var(--ink-soft); font-size: 0.82rem; line-height: 1.45; }
.license-heading .switch { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.wide-field { grid-column: 1 / -1; }
.license-fields { padding: 0; border: 0; margin: 0; }
.switch { display: flex; align-items: center; grid-template-columns: auto 1fr; gap: 8px; white-space: nowrap; }
.switch input { width: 19px; min-height: 19px; accent-color: var(--green-dark); }
.device-list { display: grid; gap: 10px; }
.device {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfbf9;
}
.device strong { display: block; overflow-wrap: anywhere; }
.device small { display: block; margin-top: 5px; color: var(--ink-soft); line-height: 1.4; }
.release-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--danger);
  border: 1px solid #ecc4c0;
  background: var(--danger-pale);
}
.release-button:hover, .release-button:focus-visible { background: #ffe2df; }
.editor-dialog .form-status { margin-top: 5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.delete-account-button {
  min-height: 44px;
  margin-right: auto;
  padding: 0 16px;
  color: var(--danger);
  border: 1px solid #ecc4c0;
  background: var(--danger-pale);
}
.delete-account-button:hover, .delete-account-button:focus-visible {
  color: #872d2d;
  border-color: #d78d87;
  background: #ffe2df;
}

.delete-dialog {
  width: min(610px, calc(100% - 30px));
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 35px 110px rgba(24, 35, 42, 0.34);
}
.delete-dialog::backdrop { background: rgba(25, 36, 43, 0.68); backdrop-filter: blur(5px); }
.delete-dialog > form { display: block; padding: clamp(23px, 4vw, 38px); }
.delete-intro { margin: 0 0 18px; color: var(--ink-soft); line-height: 1.6; }
.delete-effects {
  display: grid;
  gap: 9px;
  margin: 0 0 24px;
  padding: 18px 18px 18px 38px;
  color: #6f3333;
  border: 1px solid #f0cfcb;
  border-radius: 14px;
  background: var(--danger-pale);
  font-size: 0.88rem;
  line-height: 1.45;
}
.delete-confirmation strong { color: var(--danger); overflow-wrap: anywhere; }
.delete-dialog .form-status { margin-top: 14px; }
.delete-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.danger-button {
  min-height: 44px;
  padding: 0 17px;
  color: #fff;
  border: 0;
  background: var(--danger);
  box-shadow: 0 11px 23px rgba(166, 61, 61, 0.2);
}
.danger-button:hover, .danger-button:focus-visible { background: #872d2d; transform: translateY(-1px); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 25px clamp(22px, 5vw, 76px);
  color: var(--ink-soft);
  border-top: 1px solid rgba(37, 52, 62, 0.09);
  font-size: 0.78rem;
}

@media (max-width: 1000px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { max-width: 800px; }
  .login-panel { max-width: 650px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  main { width: min(100% - 24px, 1380px); }
  .admin-header { min-height: 82px; padding: 13px 18px; }
  .brand img { width: 190px; }
  .admin-label { display: none; }
  .dashboard-top, .customers-heading { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .maintenance-panel { align-items: flex-start; flex-direction: column; }
  .update-protection-button { width: 100%; }
  .search-field { width: 100%; }
  .table-shell { overflow: visible; }
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #fbfbf9; }
  td { display: flex; justify-content: space-between; gap: 18px; padding: 8px 0; border: 0; text-align: right; }
  td::before { content: attr(data-label); color: var(--ink-soft); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
  td:first-child { display: block; text-align: left; }
  td:first-child::before, td:last-child::before { display: none; }
  td:last-child { padding-top: 13px; }
  .manage-button { width: 100%; }
}
@media (max-width: 560px) {
  .quiet-link { font-size: 0.75rem; }
  .login-layout { padding-top: 45px; }
  .login-intro h1 { font-size: clamp(2.75rem, 15vw, 4.4rem); }
  .panel, .editor-dialog, .delete-dialog { border-radius: 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 132px; padding: 17px; border-radius: 16px; }
  .stat-card strong { font-size: 2.2rem; }
  .stat-card small { font-size: 0.72rem; }
  .form-grid { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .license-heading { flex-wrap: wrap; }
  .license-heading .switch { width: 100%; margin: 4px 0 0 50px; }
  .device { grid-template-columns: 1fr; }
  .release-button { width: 100%; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .delete-account-button { margin-right: 0; }
  .delete-actions { flex-direction: column-reverse; }
  .delete-actions button { width: 100%; }
  footer { flex-direction: column; padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
