:root {
  --accent: #bb1e24;
  --accent-dark: #8f171c;
  --background: #f4f5f7;
  --card: #ffffff;
  --ink: #20232a;
  --muted: #707581;
  --line: #e3e5e9;
  --danger-bg: #fff0f1;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(32, 35, 42, 0.06);
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  min-height: 60px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  color: var(--ink);
  font-size: 19px;
  font-weight: 850;
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 16px; }
.logout-form { margin: 0; }
.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}
.card {
  margin-bottom: 18px;
  padding: 22px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card { max-width: 430px; margin: 58px auto; }
.account-card { max-width: 600px; margin: 32px auto; }
.page-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.section-heading { align-items: center; margin-bottom: 16px; }
h1, h2 { margin-top: 0; line-height: 1.25; }
h1 { margin-bottom: 8px; font-size: 27px; }
h2 { margin-bottom: 14px; font-size: 18px; }
p { margin-top: 0; }
.eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.muted { color: var(--muted); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-grid > div {
  padding: 14px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.stat-grid strong, .stat-label { display: block; }
.stat-grid strong { margin-top: 3px; font-size: 22px; }
.stat-label { color: var(--muted); font-size: 13px; }
progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #eceef2;
  color: var(--accent);
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: #eceef2; }
progress::-webkit-progress-value,
progress::-moz-progress-bar { background: var(--accent); }
label {
  display: grid;
  gap: 6px;
  color: #333741;
  font-weight: 700;
}
input, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #cfd2d8;
  border-radius: 8px;
  font: inherit;
}
input:focus, select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(187, 30, 36, 0.12);
}
button, .button {
  display: inline-flex;
  min-height: 40px;
  padding: 9px 14px;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
button:hover, .button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}
.button-secondary { color: #30343c; background: #eceef2; }
.button-secondary:hover { background: #dfe2e7; }
.button-danger { background: #7d1518; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 14px;
  align-items: end;
}
.form-actions { display: flex; margin-top: 18px; gap: 10px; }
.form-grid .form-actions { margin-top: 0; }
.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.check-label {
  display: flex;
  min-height: 42px;
  align-items: center;
  flex-direction: row;
}
.check-label input { width: auto; min-height: 0; }
.notice {
  padding: 10px 12px;
  color: #7d1518;
  background: var(--danger-bg);
  border: 1px solid #ffd2d4;
  border-radius: 8px;
}
.notice-empty:empty { display: none; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; }
.user-table { min-width: 780px; }
.usage-cell { min-width: 170px; }
.usage-cell progress { display: block; margin-top: 5px; }
.subscription-cell {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 9px;
}
.copy-field {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}
.badge {
  display: inline-flex;
  padding: 4px 9px;
  color: #2d4933;
  background: #edf7ef;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge-off { color: #8b171b; background: var(--danger-bg); }
.pagination, .danger-zone { margin-top: 18px; }
.device-list { display: grid; gap: 10px; }
.device-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.device-item .copy-field { margin-top: 7px; }
.device-actions { display: flex; gap: 8px; align-items: center; }
.signed-in-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 18px;
  align-items: start;
}
.page-content { min-width: 0; }
.online-panel {
  position: sticky;
  top: 88px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.online-panel h2 { margin-bottom: 10px; }
.online-user { padding: 10px 0; border-top: 1px solid var(--line); }
.online-name { font-weight: 800; }
.online-meta { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.signed-in-layout { grid-template-columns: 1fr; }
	.online-panel { position: static; order: -1; }
}
@media (max-width: 640px) {
  .header-inner,
  .page-heading,
  .section-heading { align-items: stretch; flex-direction: column; }
  .header-inner { padding: 12px 16px; }
  .site-nav { width: 100%; flex-wrap: wrap; gap: 10px; }
  .page-shell { width: min(100% - 20px, 1120px); padding-top: 14px; }
  .card { padding: 16px; }
  .auth-card, .account-card { margin: 18px auto; }
  .stat-grid,
  .form-grid,
  .inline-form,
  .subscription-cell,
  .device-item { grid-template-columns: 1fr; }
  .device-actions { flex-wrap: wrap; }
}
