:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #111113;
  --panel-2: #18181a;
  --panel-3: #202024;
  --line: #2b2b30;
  --muted: #98989f;
  --text: #f7f7f8;
  --yellow: #ffd60a;
  --yellow-2: #f4b400;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --blue: #64d2ff;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 214, 10, 0.08), transparent 260px),
    radial-gradient(circle at 80% 10%, rgba(255, 214, 10, 0.12), transparent 360px),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

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

.login-card {
  width: min(460px, 100%);
  border: 1px solid rgba(255, 214, 10, 0.2);
  border-radius: 8px;
  background: rgba(17, 17, 19, 0.94);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  color: #000;
  font-weight: 950;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-card h1,
.page-title h1 {
  margin: 8px 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  font-weight: 950;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0b0c;
  color: var(--text);
  outline: none;
  padding: 12px 13px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.16);
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

.primary-btn {
  background: var(--yellow);
  color: #000;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--text);
}

.danger-btn {
  background: rgba(255, 69, 58, 0.14);
  color: #ffb4ae;
  border: 1px solid rgba(255, 69, 58, 0.34);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.error-box {
  display: none;
  border: 1px solid rgba(255, 69, 58, 0.35);
  background: rgba(255, 69, 58, 0.11);
  color: #ffd1cc;
  border-radius: 8px;
  padding: 11px 12px;
  margin-top: 14px;
}

.error-box.is-visible {
  display: block;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.92);
  padding: 20px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 20px;
}

.sidebar-brand strong {
  display: block;
  font-size: 16px;
  font-weight: 950;
}

.sidebar-brand span {
  color: var(--muted);
  font-size: 12px;
}

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

.nav-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 12px;
  text-align: left;
  font-weight: 850;
}

.nav-button.is-active {
  background: var(--yellow);
  color: #000;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

.admin-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 19, 0.86);
  padding: 10px 12px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  color: #000;
  font-weight: 950;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px auto;
  gap: 10px;
  margin-bottom: 16px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 19, 0.9);
}

.metric-card {
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
  font-weight: 950;
}

.metric-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(43, 43, 48, 0.78);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #ededee;
  font-size: 13px;
}

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

.row-title {
  font-weight: 900;
}

.row-sub {
  color: var(--muted);
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.badge.active,
.badge.premium,
.badge.subscription,
.badge.succeeded,
.badge.granted {
  background: rgba(48, 209, 88, 0.14);
  color: #9dffb4;
}

.badge.free,
.badge.pending {
  background: rgba(255, 214, 10, 0.14);
  color: var(--yellow);
}

.badge.blocked,
.badge.deleted,
.badge.failed,
.badge.revoked {
  background: rgba(255, 69, 58, 0.14);
  color: #ffb4ae;
}

.badge.manual,
.badge.stripe,
.badge.app_store,
.badge.google_play {
  background: rgba(100, 210, 255, 0.14);
  color: #a7e7ff;
}

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

.mini-btn {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--line);
}

.mini-btn.yellow {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

.mini-btn.red {
  background: rgba(255, 69, 58, 0.12);
  border-color: rgba(255, 69, 58, 0.32);
  color: #ffb4ae;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  padding: 16px;
}

.photo-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  overflow: hidden;
}

.media-box {
  display: grid;
  min-height: 180px;
  place-items: center;
  background: #050505;
  border-bottom: 1px solid var(--line);
}

.media-box img,
.media-box video {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.photo-body {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.68);
  z-index: 50;
}

.drawer-backdrop.is-open {
  display: block;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(720px, 100%);
  transform: translateX(100%);
  transition: transform 180ms ease;
  border-left: 1px solid var(--line);
  background: #0b0b0c;
  z-index: 60;
  overflow-y: auto;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 11, 12, 0.96);
  padding: 16px;
}

.drawer-content {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 5px;
}

.empty-state,
.loading-state {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  border: 1px solid rgba(255, 214, 10, 0.35);
  border-radius: 8px;
  background: rgba(17, 17, 19, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  z-index: 80;
}

.toast.is-visible {
  display: block;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .admin-chip {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list,
  .cards,
  .toolbar,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 22px;
  }
}
