:root {
  --sidebar: #132238;
  --sidebar-2: #0e1a2b;
  --ink: #17243a;
  --muted: #687386;
  --line: #e6eaf0;
  --paper: #f4f6f9;
  --card: #ffffff;
  --coral: #ff5b4d;
  --green: #1e9e61;
  --blue: #2f6fe4;
  --orange: #f28a1e;
  --teal: #12a3a0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--coral); }

.admin-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px 1fr;
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #d7e0ec;
  padding: 1.25rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.nav-section {
  margin-top: 0.4rem;
}

.nav-section-label {
  padding: 0.55rem 0.7rem 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fa0b5;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: #c9d5e4;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.85rem 0.7rem 0.2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  font-size: 0.9rem;
  color: #fff;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.btn-signout {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #d7e0ec;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-signout:hover { color: #fff; background: rgba(255,255,255,0.14); }

.main {
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.topbar .sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  padding: 1.25rem 1.5rem 2rem;
}

.card-soft {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.stat-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat-card {
  padding: 1rem 1.1rem;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-card .value {
  margin-top: 0.35rem;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-card .hint {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.dash-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 1000px) {
  .dash-grid {
    grid-template-columns: 1.4fr 1fr;
  }
}

.panel {
  padding: 1.1rem 1.2rem 1.25rem;
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.status-row {
  display: grid;
  gap: 0.65rem;
}

.status-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #f7f9fc;
}

.status-item strong { font-size: 1.05rem; }
.status-item span { color: var(--muted); font-size: 0.88rem; }

.platform-row {
  display: grid;
  gap: 0.85rem;
}

.platform-item .meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: #e8edf4;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.bar-android > span { background: var(--green); }
.bar-ios > span { background: var(--blue); }
.bar-other > span { background: var(--orange); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-android { background: #e8f7ef; color: var(--green); }
.badge-ios { background: #eaf1ff; color: var(--blue); }
.badge-other { background: #fff2e4; color: var(--orange); }
.badge-allowed { background: #e8f7ee; color: #0f7a3c; }
.badge-blocked { background: #fdecec; color: #b42318; }
.badge-expired { background: #fff4e5; color: #9a6700; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.92rem;
}

.table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table code {
  font-size: 0.82rem;
  background: #f2f5f9;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

.search-row {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.search-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-dark {
  background: var(--ink);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.filter-bar {
  margin-bottom: 1rem;
}

.filter-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: end;
  }
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-bar .form-control {
  margin-bottom: 0;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(700px 300px at 80% 10%, rgba(255,91,77,0.18), transparent 60%),
    var(--paper);
}

.login-card {
  width: min(420px, 100%);
  padding: 1.5rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.login-card p {
  margin: 0 0 1.1rem;
  color: var(--muted);
}

.form-label { display: block; margin-bottom: 0.3rem; font-weight: 650; }
.form-control {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.85rem;
}

.text-danger { color: #b42318; }
.text-muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; }
