:root {
  --bg: #f3f7f4;
  --surface: #ffffff;
  --ink: #172126;
  --muted: #66736c;
  --line: #d9e2dc;
  --teal: #087f7b;
  --teal-dark: #075c59;
  --coral: #db5a42;
  --amber: #f2a541;
  --green: #27a36a;
  --red: #c53030;
  --shadow: 0 18px 45px rgba(23, 33, 38, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(8, 127, 123, 0.08), transparent 34%),
    linear-gradient(240deg, rgba(219, 90, 66, 0.08), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a,
.nav-dropdown summary {
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.nav-list a:hover,
.nav-dropdown summary:hover {
  background: #e8f0eb;
  color: var(--ink);
}

.nav-dropdown {
  display: grid;
  gap: 6px;
}

.nav-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary::after {
  content: "v";
  margin-left: 12px;
}

.nav-dropdown[open] summary::after {
  content: "^";
}

.nav-dropdown a {
  display: block;
  margin-left: 10px;
  padding-left: 18px;
  font-size: 14px;
}

.sidebar-logout {
  margin-top: auto;
}

.sidebar-user {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.sidebar-user-label,
.sidebar-user span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-user strong {
  color: var(--ink);
  font-size: 15px;
}

.sidebar-user + .sidebar-logout {
  margin-top: 0;
}

.main-content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 40px clamp(18px, 4vw, 48px);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.eyebrow,
.card-label {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
}

h2 {
  margin-bottom: 18px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--teal);
  color: white;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.compact {
  min-height: 38px;
  padding: 0 14px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.login-panel {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 44px;
  align-items: center;
}

.login-copy h1 {
  margin-bottom: 18px;
  font-size: clamp(48px, 9vw, 92px);
}

.login-copy p:last-child {
  max-width: 560px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.login-card,
.info-card {
  border: 1px solid rgba(217, 226, 220, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 26px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

input:focus {
  outline: 3px solid rgba(8, 127, 123, 0.18);
  border-color: var(--teal);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.super-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.super-panel[hidden] {
  display: none;
}

.super-user-row,
.subscription-form {
  display: grid;
  gap: 12px;
}

.super-user-row {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px);
}

.subscription-form {
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  align-items: end;
}

.success-message {
  min-height: 22px;
  margin: 0;
  color: var(--teal-dark);
  font-weight: 800;
}

.managed-user-panel,
.admin-toolbar,
.registration-form {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.managed-user-panel {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px);
}

.admin-toolbar {
  grid-template-columns: minmax(220px, 360px);
}

.registration-form {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  align-items: end;
}

.managed-user-panel[hidden],
.account-workspace[hidden],
.admin-workspace[hidden] {
  display: none;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tab-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.tab-button.active {
  border-color: var(--teal);
  background: #e5f2ef;
  color: var(--teal-dark);
}

.support-alert {
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff1df;
  color: #8f2f1d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.form-error {
  min-height: 22px;
  color: var(--red);
  font-weight: 800;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 18px;
}

.info-card {
  padding: 22px;
}

.info-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.info-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.info-list dt {
  color: var(--muted);
  font-weight: 800;
}

.info-list dd {
  margin: 0;
  font-weight: 800;
}

.status-pill,
.storage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  background: #e5f2ef;
  color: var(--teal-dark);
  font-weight: 900;
}

.quota-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 16px 0;
}

.quota-line strong {
  font-size: 30px;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e3;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 260ms ease;
}

.progress-fill.normal {
  background: var(--green);
}

.progress-fill.vip {
  background: var(--amber);
}

.vip-expiry {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.vip-expiry.expired {
  color: var(--red);
}

.contact-dialog {
  width: min(360px, calc(100vw - 36px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.contact-dialog::backdrop {
  background: rgba(23, 33, 38, 0.35);
}

.dialog-inner {
  padding: 24px;
}

.toolbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(150px, 1fr) auto auto auto auto;
  gap: 12px;
  align-items: end;
}

.account-form-simple {
  grid-template-columns: minmax(150px, 1.2fr) minmax(150px, 1fr) auto auto;
}

.check-line {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 8px;
  white-space: nowrap;
}

.check-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.account-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.admin-table {
  min-width: 920px;
}

.admin-table input[type="date"],
.admin-table input[type="number"] {
  min-width: 132px;
}

.account-table th,
.account-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.account-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.account-table tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.user-actions {
  align-items: center;
  flex-wrap: wrap;
}

.password-action {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-action input {
  min-height: 38px;
}

.pool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pool-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
}

.pool-badge.normal {
  background: #e9f5ee;
  color: #16774a;
}

.pool-badge.vip {
  background: #fff0cf;
  color: #9a5c00;
}

.pool-badge.muted {
  background: #eef2ef;
  color: var(--muted);
}

.icon-check {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  background: #e9f5ee;
  color: var(--green);
  font-weight: 900;
}

.icon-empty {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  background: #eef2ef;
  color: var(--muted);
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 920px) {
  .app-shell,
  .login-panel,
  .overview-grid,
  .toolbar-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
    overflow-x: visible;
  }

  .nav-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 6px;
  }

  .sidebar-logout {
    margin-top: 0;
    margin-left: 0;
  }

  .sidebar-user {
    min-width: 0;
    margin-top: 0;
    margin-left: 0;
  }

  .main-content {
    padding-top: 26px;
  }

  .account-form {
    grid-template-columns: 1fr 1fr;
  }

  .super-user-row,
  .subscription-form,
  .managed-user-panel,
  .registration-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-page {
    padding: 18px;
  }

  .login-card {
    padding: 20px;
  }

  .account-form {
    grid-template-columns: 1fr;
  }

  .super-user-row,
  .subscription-form,
  .managed-user-panel,
  .registration-form,
  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    align-items: stretch;
  }

  .brand span:last-child {
    display: inline;
  }
}
