:root {
  color-scheme: light;
  --ink: #17191e;
  --muted: #6f7480;
  --line: #e3e6eb;
  --surface: #ffffff;
  --canvas: #f5f6f8;
  --red: #ff2442;
  --red-dark: #dd1733;
  --cyan: #13c8cb;
  --ok: #16875b;
  --warn: #b66b00;
  --danger: #c6313e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { min-height: 100vh; }
.login-view {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  min-height: 100vh;
  background: #17181d;
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 60px;
  color: #fff;
  border-right: 1px solid rgba(255,255,255,.1);
}
.login-brand img { width: 104px; height: 104px; border-radius: 22px; }
.login-brand div, .brand div { display: grid; gap: 3px; }
.login-brand strong { font-size: 32px; }
.login-brand span { color: #b9bdc6; }
.login-form {
  align-self: center;
  width: min(420px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0,0,0,.24);
}
.login-form header { margin-bottom: 26px; }
.login-form h1, .page-heading h1, .dialog h2 { margin: 0; }
.login-form header p, .page-heading p, .dialog header p { margin: 7px 0 0; color: var(--muted); }
label { display: grid; gap: 7px; margin-bottom: 16px; }
label > span { color: #50545d; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; outline: 0;
}
input, select { height: 42px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,36,66,.1); }
.login-form > button, .primary-action {
  min-height: 42px; padding: 0 18px; border: 0; border-radius: 7px; color: #fff; background: var(--red); font-weight: 800;
}
.login-form > button { width: 100%; }
.login-form > button:hover, .primary-action:hover { background: var(--red-dark); }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; height: 68px; padding: 0 28px;
  color: #fff; background: #191a1f; border-bottom: 3px solid var(--red);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { width: 38px; height: 38px; border-radius: 9px; }
.brand strong { font-size: 17px; }
.brand span { color: #adb1ba; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.service-status { color: #b7f1e6; font-size: 12px; }
.content { width: min(1380px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 54px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { font-size: 26px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: #fff; }
.metrics div { display: grid; gap: 5px; min-height: 96px; padding: 20px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { color: var(--muted); font-size: 12px; }
.metrics strong { font-size: 28px; }
.metrics div:nth-child(2) strong { color: var(--ok); }
.metrics div:nth-child(3) strong { color: var(--warn); }
.account-section { margin-top: 18px; border: 1px solid var(--line); background: #fff; }
.table-toolbar { display: grid; grid-template-columns: minmax(220px, 360px) 150px auto; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.account-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #fafbfc; font-size: 12px; }
td { font-size: 13px; }
.account-name { display: grid; gap: 3px; }
.account-name span { color: var(--muted); font-size: 11px; }
.status { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status.active { color: var(--ok); background: #e8f5ef; }
.status.disabled, .status.expired { color: var(--danger); background: #fdecef; }
.row-action { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.row-action:hover { border-color: var(--cyan); }
.quiet-button, .danger-quiet {
  min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff;
}
.topbar .quiet-button { color: #fff; border-color: rgba(255,255,255,.22); background: transparent; }
.danger-quiet { color: var(--danger); border-color: #f0bdc4; }
.empty-state { padding: 50px; color: var(--muted); text-align: center; }

.dialog-layer { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(16,17,21,.64); }
.dialog { width: min(720px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 24px; border-radius: 8px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.icon-close { width: 34px; height: 34px; border: 0; border-radius: 6px; color: var(--muted); background: #f1f2f4; font-size: 23px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.full-width { grid-column: 1 / -1; }
.password-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.dialog footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; margin-top: 20px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 12px 16px; border-radius: 7px; color: #fff; background: #202126; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 820px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div:nth-child(2) { border-right: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .page-heading { align-items: flex-start; }
}
