.admin-body { min-height: 100vh; background: #f4f7fb; }
.admin-shell { display: grid; min-height: 100vh; grid-template-columns: 258px 1fr; }
.admin-sidebar { position: sticky; top: 0; display: grid; height: 100vh; grid-template-rows: auto 1fr auto; padding: 25px 18px 18px; color: #b7c4d7; background: #0a1020; }
.admin-sidebar .brand { padding: 0 9px 24px; }
.admin-sidebar .brand strong { color: #fff; }
.admin-sidebar .brand small { color: #71829d; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; }
.admin-sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 10px; color: #9eacc1; font-size: .86rem; font-weight: 650; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { color: #fff; background: #152440; }
.admin-sidebar nav a span { width: 7px; height: 7px; border: 1px solid #5f718f; border-radius: 50%; }
.admin-sidebar nav a.active span { border-color: #6ee7d6; background: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.12); }
.admin-sidebar-bottom { padding: 17px 8px 0; border-top: 1px solid #24314a; }
.admin-sidebar-bottom a, .admin-sidebar-bottom button { display: block; width: 100%; padding: 8px 5px; border: 0; color: #8292aa; background: transparent; text-align: left; font-size: .78rem; }
.admin-sidebar-bottom a:hover, .admin-sidebar-bottom button:hover { color: #fff; }
.admin-main { min-width: 0; }
.admin-topbar { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 32px; border-bottom: 1px solid #e2e8f0; background: #fff; }
.admin-topbar div { display: grid; }
.admin-topbar span { color: #64748b; font-size: .62rem; font-weight: 800; letter-spacing: .1em; }
.admin-topbar strong { font-size: .9rem; }
.admin-topbar em { padding: 7px 10px; border-radius: 9px; color: #126956; background: #e9fbf6; font-size: .72rem; font-style: normal; font-weight: 750; }
.admin-content { width: min(calc(100% - 54px), 1240px); margin: 0 auto; padding: 34px 0 50px; }
.admin-heading { margin-bottom: 25px; }
.admin-heading > span { color: #2563eb; font-size: .66rem; font-weight: 850; letter-spacing: .12em; }
.admin-heading h1 { margin-top: 5px; font-size: 2rem; }
.admin-heading p { margin: 5px 0 0; color: #64748b; }
.admin-alert { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 14px 16px; border: 1px solid #bfd6fb; border-radius: 12px; color: #234f91; background: #eff6ff; font-size: .82rem; }
.admin-alert strong { min-width: max-content; }
.admin-alert span { flex: 1; }
.admin-alert a { color: #1d4ed8; font-weight: 750; }
.admin-alert.warning { border-color: #f3d69a; color: #7c5709; background: #fff9e9; }
.admin-alert.success { border-color: #b8eadf; color: #176654; background: #effcf8; }
.admin-alert.error { border-color: #fecaca; color: #991b1b; background: #fef2f2; }
.admin-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.admin-metrics article, .admin-card { border: 1px solid #e2e8f0; border-radius: 15px; background: #fff; box-shadow: 0 9px 30px rgba(15,23,42,.035); }
.admin-metrics article { display: grid; padding: 21px; }
.admin-metrics article > span { color: #64748b; font-size: .63rem; font-weight: 850; letter-spacing: .08em; }
.admin-metrics article > strong { margin: 7px 0 2px; font-size: 1.8rem; line-height: 1.1; }
.admin-metrics article > small { color: #64748b; font-size: .72rem; }
.admin-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; margin-top: 17px; }
.admin-card { padding: 24px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-title div { display: grid; }
.card-title span { color: #64748b; font-size: .62rem; font-weight: 850; letter-spacing: .08em; }
.card-title h2, .admin-card > h2 { margin-top: 3px; font-size: 1.08rem; }
.card-title a { color: #2563eb; font-size: .76rem; font-weight: 750; }
.empty-state { display: grid; min-height: 185px; place-content: center; gap: 5px; border: 1px dashed #cbd5e1; border-radius: 12px; color: #64748b; text-align: center; }
.empty-state strong { color: #334155; }
.empty-state span { font-size: .8rem; }
.admin-list { display: grid; }
.admin-list > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid #edf0f5; }
.admin-list > div:last-child { border-bottom: 0; }
.admin-list span { display: grid; }
.admin-list strong { font-size: .85rem; }
.admin-list small, .admin-list em { color: #64748b; font-size: .72rem; font-style: normal; }
.release-summary { margin: 14px 0 20px; }
.release-summary > div { display: grid; gap: 2px; padding: 11px 0; border-bottom: 1px solid #edf0f5; }
.release-summary dt { color: #64748b; font-size: .67rem; font-weight: 750; }
.release-summary dd { margin: 0; overflow-wrap: anywhere; font-size: .82rem; }
.release-summary .hash-value { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: .67rem; }
.admin-form { display: grid; gap: 19px; }
.admin-form label { font-size: .8rem; }
.admin-form input, .admin-form textarea, .admin-form select { min-height: 44px; font-size: .86rem; }
.form-section { display: grid; gap: 16px; padding-bottom: 23px; border-bottom: 1px solid #e2e8f0; }
.form-section h2 { font-size: 1.08rem; }
.admin-form .button { justify-self: start; }
.admin-note { display: flex; gap: 14px; padding: 14px 16px; border: 1px solid #cfe0fb; border-radius: 11px; color: #334155; background: #f2f7ff; font-size: .8rem; }
.admin-note strong { min-width: max-content; color: #1d4ed8; }
.plan-editor-head, .plan-editor-row { display: grid; grid-template-columns: 1.1fr .65fr 1fr .8fr 65px; align-items: center; gap: 12px; }
.plan-editor-head { padding: 0 10px; color: #64748b; font-size: .63rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.plan-editor-row { padding: 12px 10px; border: 1px solid #e2e8f0; border-radius: 11px; }
.plan-editor-row strong { font-size: .85rem; }
.plan-editor-row input { min-height: 40px; }
.switch { position: relative; display: block; width: 44px; height: 24px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: .2s ease; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(15,23,42,.18); content: ""; transition: .2s ease; }
.switch input:checked + span { background: #2563eb; }
.switch input:checked + span::after { transform: translateX(20px); }
.release-admin { grid-template-columns: 1fr 1fr; }
.admin-card > p { color: #64748b; font-size: .82rem; }
.admin-card > small { color: #64748b; font-size: .7rem; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 17px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
th { color: #64748b; background: #f8fafc; font-size: .63rem; letter-spacing: .07em; text-transform: uppercase; }
td { color: #475569; font-size: .78rem; }
td strong { color: #0f172a; }
td small { display: block; margin-top: 2px; color: #64748b; }
td code { color: #334155; font-size: .7rem; }
.table-status { display: inline-flex; padding: 5px 8px; border-radius: 7px; color: #176654; background: #e9fbf6; font-size: .67rem; font-weight: 750; }
.table-card > .empty-state { margin: 24px; }
.account-grid { grid-template-columns: .7fr 1.3fr; }
.password-rule { margin: -8px 0 0; color: #64748b; font-size: .72rem; }

.admin-sidebar { overflow-y: auto; }
.admin-sidebar nav { padding-bottom: 14px; }
.tenant-chip { display: grid; gap: 4px; margin: 0 4px 18px; padding: 13px; border: 1px solid #253450; border-radius: 12px; background: #111d34; }
.tenant-chip small { color: #7083a1; font-size: .62rem; font-weight: 800; letter-spacing: .08em; }
.tenant-chip strong { overflow: hidden; color: #fff; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.billing-dot { justify-self: start; margin-top: 4px; padding: 4px 7px; border-radius: 999px; color: #8ef0d8; background: #123d3a; font-size: .62rem; font-weight: 800; }
.billing-dot.overdue, .billing-dot.blocked, .billing-dot.trial_expired { color: #fecaca; background: #4b1f29; }
.operations-grid { grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); align-items: start; }
.compact-form { position: sticky; top: 88px; }
.compact-form h2 { margin-bottom: 2px; font-size: 1.05rem; }
.table-filters { display: grid; grid-template-columns: minmax(180px, 1fr) 180px auto; gap: 9px; padding: 16px; border-bottom: 1px solid #e8edf5; background: #fbfcfe; }
.table-filters input, .table-filters select { min-height: 39px; padding: 8px 10px; border: 1px solid #dbe3ef; border-radius: 8px; background: #fff; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.row-actions > a, .cancel-edit { color: #2563eb; font-size: .72rem; font-weight: 750; }
.row-actions form, .inline-status { display: inline-flex; gap: 5px; }
.row-actions select, .inline-status select { width: 128px; min-height: 31px; padding: 5px; border: 1px solid #dbe3ef; border-radius: 7px; background: #fff; font-size: .7rem; }
.row-actions button, .inline-status button { min-height: 31px; padding: 5px 8px; border: 0; border-radius: 7px; color: #1d4ed8; background: #eaf1ff; font-size: .68rem; font-weight: 800; cursor: pointer; }
.row-actions .danger-link { color: #b91c1c; background: #fff1f2; }
.pagination { display: flex; gap: 6px; padding: 14px 17px; }
.pagination a { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid #dbe3ef; border-radius: 8px; color: #475569; font-size: .75rem; font-weight: 750; }
.pagination a.active { color: #fff; border-color: #2563eb; background: #2563eb; }
.status-overdue, .status-blocked, .status-cancelled { color: #b42318; background: #fff0ee; }
.status-waiting, .status-pending, .status-trial { color: #9a5d08; background: #fff7df; }
.status-in_progress, .status-open, .status-scheduled { color: #1d4ed8; background: #edf3ff; }
.status-paid, .status-resolved, .status-completed, .status-done, .status-active { color: #176654; background: #e9fbf6; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.action-grid a { display: grid; gap: 4px; padding: 15px; border: 1px solid #e1e8f3; border-radius: 11px; background: #fbfcfe; }
.action-grid strong { color: #17233a; font-size: .82rem; }
.action-grid span { color: #64748b; font-size: .7rem; line-height: 1.45; }
.login-points { display: grid; gap: 9px; margin-top: 24px; color: #c8d5e8; font-size: .85rem; }
.login-card label span { color: #94a3b8; font-weight: 500; }
.login-card > small { color: #94a3b8; text-align: center; font-size: .66rem; line-height: 1.45; }

.login-body { min-height: 100vh; background: #f7f9fc; }
.login-layout { display: grid; min-height: 100vh; grid-template-columns: .9fr 1.1fr; }
.login-brand { display: grid; grid-template-rows: auto 1fr auto; padding: 50px; color: #b3c0d4; background: radial-gradient(circle at 80% 20%, rgba(37,99,235,.25), transparent 32%), radial-gradient(circle at 5% 90%, rgba(20,184,166,.14), transparent 28%), #0a1020; }
.login-brand .brand strong { color: #fff; }
.login-brand .brand small { color: #7385a1; }
.login-brand > div { max-width: 520px; align-self: center; }
.login-brand h1 { color: #fff; font-size: clamp(2.6rem, 5vw, 4.5rem); }
.login-brand p { color: #95a5ba; font-size: 1.03rem; }
.login-brand > small { color: #64748b; }
.login-panel { display: grid; place-items: center; padding: 28px; }
.login-card { display: grid; width: min(100%, 430px); gap: 17px; padding: 38px; border: 1px solid #e2e8f0; border-radius: 20px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.1); }
.login-card > img { margin-bottom: 5px; }
.login-card h2 { font-size: 1.7rem; }
.login-card > p { margin: -8px 0 5px; color: #64748b; }
.login-card > a { color: #64748b; text-align: center; font-size: .78rem; }

@media (max-width: 1050px) {
  .admin-shell { grid-template-columns: 220px 1fr; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
  .admin-grid, .release-admin { grid-template-columns: 1fr; }
  .operations-grid { grid-template-columns: 1fr; }
  .compact-form { position: static; }
}

@media (max-width: 760px) {
  .admin-shell { display: block; }
  .admin-sidebar { position: static; height: auto; grid-template-rows: auto auto auto; }
  .admin-sidebar nav { display: grid; grid-template-columns: 1fr 1fr; }
  .admin-sidebar-bottom { display: flex; justify-content: space-between; }
  .admin-topbar { padding-inline: 18px; }
  .admin-content { width: min(calc(100% - 28px), 1240px); }
  .plan-editor-head { display: none; }
  .plan-editor-row { grid-template-columns: 1fr 1fr; }
  .plan-editor-row strong { grid-column: 1 / -1; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 370px; padding: 30px; }
  .login-brand h1 { font-size: 2.7rem; }
}

@media (max-width: 510px) {
  .admin-metrics { grid-template-columns: 1fr; }
  .admin-sidebar nav { grid-template-columns: 1fr; }
  .admin-alert { align-items: flex-start; flex-direction: column; }
  .admin-note { flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
  .table-filters { grid-template-columns: 1fr; }
  .row-actions { align-items: flex-start; flex-direction: column; }
  .action-grid { grid-template-columns: 1fr; }
}
