/* RoyalSonic User Admin — sleek Mailbox blue default */
:root {
  --accent: #5b7cff;
  --accent-deep: #3d5bd6;
  --accent-hover: #4a6af0;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e6eaf2;
  --bg: #f4f6fb;
  --sidebar: #eef1f8;
  --selected: #eef2ff;
  --panel: #fff;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Outfit", "Syne", sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}
#app { min-height: 100vh; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(400px, 100%);
  padding: 2rem 1.75rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.08);
}
.login-logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: 220px;
  margin: 0 auto 0.65rem;
  object-fit: contain;
}
.login-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0 0;
}
.login-copy { margin: 1.15rem 0 1.25rem; }
.login-title {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f2937;
}
.login-title span { color: var(--accent); }
.login-sub { margin: 0; font-size: 0.92rem; color: var(--muted); }
.login-field { margin-bottom: 0.95rem; }
.login-pw-wrap { position: relative; }
.login-pw-wrap input { padding-right: 4.25rem; }
.login-pw-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.35rem 0.45rem;
}
.login-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}
.login-card input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  font: inherit;
  outline: none;
}
.login-card input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.22);
}
.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
}
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.is-busy { opacity: 0.75; pointer-events: none; }
.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.login-error {
  display: none;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(227, 6, 19, 0.08);
  border: 1px solid rgba(227, 6, 19, 0.22);
  color: var(--accent-deep);
  font-size: 0.9rem;
}
.login-error.is-visible { display: block; }
.login-help {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.login-help button {
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  gap: 0.85rem;
  padding: 0.85rem;
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
.sidebar {
  background: var(--sidebar, #eef1f8);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.sidebar .brand { margin-bottom: 0.55rem; }
.sidebar .brand img { height: 36px; width: auto; }
.nav-list { display: grid; gap: 0.45rem; }
.nav-btn {
  --nav-deep: #5c4033;
  --nav-soft: #efe6d8;
  --nav-fg: #5c4033;
  --nav-icon-fg: #fff;
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: var(--nav-fg);
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  min-height: 44px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
.nav-btn.theme-cream {
  --nav-deep: #3d2a22;
  --nav-soft: #efe6d8;
  --nav-fg: #3d2a22;
  --nav-icon-fg: #fff;
}
.nav-btn.theme-teal {
  --nav-deep: #0f4f4b;
  --nav-soft: #2f8f88;
  --nav-fg: #fff;
  --nav-icon-fg: #fff;
}
.nav-btn.theme-coral {
  --nav-deep: #8f3a2c;
  --nav-soft: #d96a58;
  --nav-fg: #fff;
  --nav-icon-fg: #fff;
}
.nav-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}
.nav-btn.active {
  outline: 2px solid color-mix(in srgb, var(--nav-deep) 55%, #fff);
  outline-offset: 1px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
}
.nav-icon {
  flex: 0 0 48px;
  width: 48px;
  height: auto;
  border-radius: 0;
  display: grid;
  place-items: center;
  color: #fff !important;
  background: var(--nav-deep) !important;
  box-shadow: none !important;
}
.nav-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke: #fff;
  color: #fff;
  fill: currentColor;
}
.nav-label {
  flex: 1;
  display: grid;
  place-items: center start;
  padding: 0 0.85rem;
  background: var(--nav-soft);
  color: var(--nav-fg);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  line-height: 1.1;
}
.side-stats {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.45rem;
}
.side-stats-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.2rem 0.15rem;
}
.side-stat {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.55rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--stat-color) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--stat-color) 22%, #e5e7eb);
}
.side-stat-icon {
  width: 22px;
  height: 22px;
  border-radius: 0;
  display: grid;
  place-items: center;
  color: var(--stat-color, var(--accent));
  background: none !important;
  box-shadow: none !important;
  flex-shrink: 0;
}
.side-stat-icon svg { width: 20px; height: 20px; stroke: currentColor; color: inherit; }
.side-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.side-stat-value {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.1rem;
}
.main {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.topbar {
  padding: 1.1rem 1.4rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
}
.topbar p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.content { padding: 1.1rem 1.4rem 2rem; flex: 1; }
.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--selected, #eef2ff);
  border: 1px solid rgba(227, 6, 19, 0.18);
  margin-bottom: 1rem;
  font-size: 0.88rem;
}
.plan-chip span { color: var(--muted); font-weight: 600; }
.plan-chip b { color: var(--accent-deep); }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

/* AdminLTE-style service / metric boxes */
.svc-box {
  --svc: #0A7CFF;
  display: flex;
  align-items: stretch;
  min-height: 92px;
  border-radius: 6px;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}
a.svc-box,
button.svc-box {
  cursor: pointer;
  appearance: none;
  border: 0;
  padding: 0;
  font: inherit;
  width: 100%;
  text-align: left;
}
a.svc-box:hover,
button.svc-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
  filter: brightness(1.03);
}
.svc-box-icon {
  flex: 0 0 28%;
  max-width: 7.5rem;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--svc) 62%, #0b1220);
  color: #fff;
}
.svc-box-icon svg {
  width: 2.15rem;
  height: 2.15rem;
  stroke: currentColor;
}
.svc-box-body {
  flex: 1;
  min-width: 0;
  background: var(--svc);
  padding: 0.7rem 0.85rem 0.65rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
}
.svc-box-top,
.svc-box-bot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.55rem;
}
.svc-box-label {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.svc-box-value {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58%;
}
.svc-box-sub {
  font-size: 0.8rem;
  opacity: 0.92;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.svc-box-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #fff;
  color: var(--svc);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
.svc-box-pill.is-down { color: #1d4ed8; }
.svc-box-pill.is-up { color: color-mix(in srgb, var(--svc) 70%, #064e3b); }
.svc-box-pill.is-muted {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: none;
}

.stat-card {
  /* legacy alias — prefer .svc-box */
  background: color-mix(in srgb, var(--stat-color) 8%, #fff);
  border: 1px solid color-mix(in srgb, var(--stat-color) 20%, #e5e7eb);
  border-radius: 14px;
  padding: 0.95rem 1rem;
}
.stat-card-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.stat-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
}
.stat-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-card-main {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat-card-sub {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 0.15rem;
  margin-bottom: 0.55rem;
}
.stat-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.06);
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--stat-color);
  width: 0;
  transition: width 0.35s ease;
}
.stat-fill.is-hot { background: linear-gradient(90deg, var(--accent), var(--accent-hover)); }
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: #111;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  z-index: 50;
  font-size: 0.9rem;
}
.toast.err { background: var(--accent-deep); }
.suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}
.suite-card {
  display: block;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  text-decoration: none;
  color: inherit;
}
.suite-card:hover { border-color: var(--accent); }
.suite-card b { display: block; margin-bottom: 0.25rem; }
.suite-card span { color: var(--muted); font-size: 0.85rem; }

/* Colorful person / alias cards (Users page) */
.ua-people-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
  margin-bottom: 1rem;
}
.ua-split-btn {
  --split: #e07a6a;
  --split-deep: #c45f52;
  display: inline-flex;
  align-items: stretch;
  min-height: 46px;
  border: 2px solid var(--split-deep);
  border-radius: 8px;
  overflow: hidden;
  background: var(--split);
  color: #fff;
  cursor: pointer;
  padding: 0;
  font: inherit;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.ua-split-btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.ua-split-btn.is-alias {
  --split: #3d8bfd;
  --split-deep: #2563eb;
}
.ua-split-plus {
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  background: var(--split-deep);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
}
.ua-split-label {
  display: grid;
  place-items: center;
  padding: 0 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.88rem;
}
.ua-quota-chip {
  margin-left: auto;
  align-self: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.ua-domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-top: 0.35rem;
}
.ua-domain-grid .svc-box-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 62%;
}
.ua-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ua-person-card {
  --c1: #0d9488;
  --c2: #f59e0b;
  --c3: #f07167;
  --c4: #38bdf8;
  border-radius: 10px;
  overflow: hidden;
  background: #eef1f5;
  border: 1px solid #dde3ea;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.ua-person-card.is-alias {
  --c1: #2563eb;
  --c2: #7c3aed;
  --c3: #db2777;
  --c4: #06b6d4;
  background: #eef2ff;
  border-color: #c7d2fe;
}
.ua-person-head {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  min-height: 40px;
}
.ua-person-head-ico,
.ua-person-head-role,
.ua-person-head-meta {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.ua-person-head-ico { background: var(--c1); }
.ua-person-head-ico svg { width: 18px; height: 18px; }
.ua-person-head-role {
  background: var(--c2);
  font-size: 0.78rem;
  text-transform: uppercase;
  padding: 0 0.75rem;
  justify-content: start;
  place-content: center start;
}
.ua-person-head-meta {
  background: var(--c3);
  min-width: 48px;
  padding: 0 0.75rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.ua-person-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
}
.ua-person-info {
  flex: 1 1 12rem;
  min-width: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ua-person-name {
  font-weight: 800;
  font-size: 1rem;
  color: #0f172a;
  line-height: 1.25;
  word-break: break-word;
}
.ua-person-email {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.86rem;
  word-break: break-all;
}
.ua-person-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ua-act {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}
.ua-act:hover { filter: brightness(1.06); }
.ua-act-edit { background: #f59e0b; }
.ua-act-view { background: #38bdf8; }
.ua-act-alias { background: #0d9488; }
.ua-act-del { background: #ef4444; }
.ua-person-card.is-alias .ua-act-edit { background: #7c3aed; }
.ua-person-card.is-alias .ua-act-view { background: #2563eb; }
.ua-person-foot {
  display: flex;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem 0.55rem;
  background: #e4e8ee;
}
.ua-person-card.is-alias .ua-person-foot { background: #e0e7ff; }
.ua-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.ua-dot:nth-child(1) { background: var(--c1); }
.ua-dot:nth-child(2) { background: var(--c2); }
.ua-dot:nth-child(3) { background: var(--c3); }
.ua-dot:nth-child(4) { background: var(--c4); }
.ua-empty {
  color: var(--muted);
  padding: 0.75rem 0.25rem;
  font-size: 0.92rem;
}
@media (max-width: 640px) {
  .ua-person-head { grid-template-columns: 44px 1fr auto; }
  .ua-split-label { padding: 0 0.85rem; font-size: 0.8rem; }
}
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; }
.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.4);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}
.modal {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.35rem;
  border: 1px solid var(--line);
}
.modal h3 { margin: 0 0 0.35rem; font-family: var(--display); }
.modal .sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
.spacer { flex: 1; }
.foot { font-size: 0.8rem; color: var(--muted); padding: 0.5rem 0.7rem; }
