/* Amaz Backend — premium light theme (white / silver) */
:root {
  --bg: #f4f5f9;
  --bg-2: #eceef4;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --border: #e4e7ef;
  --border-2: #d6dae5;
  --text: #171a33;
  --text-2: #4b5168;
  --muted: #8a90a6;
  --primary: #6d28d9;
  --primary-2: #8b5cf6;
  --primary-soft: #f1ebff;
  --grad: linear-gradient(135deg, #3b1d8f 0%, #6d28d9 45%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, #f6f1ff 0%, #eef2ff 100%);
  --silver: linear-gradient(145deg, #ffffff 0%, #f1f3f8 55%, #e7eaf2 100%);
  --green: #10b981; --green-soft: #e7f8f1;
  --orange: #f59e0b; --orange-soft: #fff4e0;
  --blue: #2563eb; --blue-soft: #e8efff;
  --pink: #ec4899; --pink-soft: #fde9f3;
  --teal: #0891b2; --teal-soft: #e3f6fa;
  --red: #e11d48; --red-soft: #ffe8ee;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 26, 51, .04), 0 8px 24px rgba(23, 26, 51, .06);
  --shadow-lg: 0 20px 60px rgba(59, 29, 143, .18);
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 600; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
img { max-width: 100%; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: 500 14px var(--font); cursor: pointer; text-decoration: none !important;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(109, 40, 217, .28); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(109, 40, 217, .38); }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-light:hover { background: var(--surface-2); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #ffd0dc; }
.btn-danger:hover { background: #ffdbe4; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--primary); }
.icon-btn.danger:hover { color: var(--red); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font: 400 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(139, 92, 246, .15); }
.input-group { position: relative; }
.input-group .input { padding-left: 42px; }
.input-group > svg.i { position: absolute; left: 14px; top: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert-error { background: var(--red-soft); color: #9f1239; border: 1px solid #ffd0dc; }
.alert-success { background: var(--green-soft); color: #047857; border: 1px solid #c6f0df; }
.alert-info { background: var(--blue-soft); color: #1e40af; border: 1px solid #cfdcff; }
.alert-warn { background: var(--orange-soft); color: #92400e; border: 1px solid #fde3b0; }

/* ---------- Auth / installer layout ---------- */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(168, 85, 247, .16), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(37, 99, 235, .12), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 520px; background: var(--surface); border-radius: 24px;
  box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid rgba(255, 255, 255, .7);
  animation: rise .45s ease both;
}
.auth-card.wide { max-width: 640px; }
.auth-head { position: relative; padding: 28px 32px 46px; color: #fff; background: var(--grad); overflow: hidden; }
.auth-head::after {
  content: ""; position: absolute; left: -5%; right: -5%; bottom: -1px; height: 36px;
  background: var(--surface); border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.auth-head .orb { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.auth-head .orb.a { width: 180px; height: 180px; right: -50px; top: -70px; }
.auth-head .orb.b { width: 90px; height: 90px; right: 90px; top: 30px; background: rgba(255, 255, 255, .08); }
.brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand h1 { font-size: 20px; margin: 0; color: #fff; }
.brand p { margin: 0; font-size: 12.5px; opacity: .85; }
.auth-content { padding: 8px 32px 28px; }
.auth-foot { padding: 16px 32px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* Stepper */
.stepper { display: flex; gap: 8px; margin: 0 0 22px; }
.stepper .s { flex: 1; }
.stepper .bar { height: 5px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.stepper .bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .4s; }
.stepper .s.done .bar span, .stepper .s.on .bar span { width: 100%; }
.stepper .lbl { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.stepper .s.on .lbl { color: var(--primary); font-weight: 600; }

.req-list { list-style: none; padding: 0; margin: 0 0 18px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.req-list li { display: flex; justify-content: space-between; padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.req-list li:last-child { border-bottom: 0; }
.ok { color: var(--green); font-weight: 600; }
.bad { color: var(--red); font-weight: 600; }

.success-mark {
  width: 76px; height: 76px; border-radius: 50%; margin: 6px auto 16px; display: flex; align-items: center; justify-content: center;
  background: var(--green-soft); color: var(--green); animation: pop .5s ease both;
}
.success-mark svg { width: 38px; height: 38px; stroke-width: 2.5; }
.copy-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.copy-box code { flex: 1; font-size: 13px; word-break: break-all; color: var(--text); }

/* ---------- Admin layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 30;
}
.sidebar .brand { padding: 20px 20px 18px; }
.sidebar .brand-mark { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(109, 40, 217, .3); }
.sidebar .brand h1 { color: var(--text); font-size: 17px; }
.sidebar .brand p { color: var(--muted); opacity: 1; }
.nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; text-decoration: none; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a.active svg.i { stroke: var(--primary); }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(255, 255, 255, .8); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 18px; }
.topbar .sp { flex: 1; }
.menu-btn { display: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px; background: var(--grad); flex: none;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .nm { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-chip .rl { font-size: 11.5px; color: var(--muted); }
.content { padding: 26px 28px 40px; flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sp { flex: 1; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; }
.card-head .sp { flex: 1; }
.mb { margin-bottom: 20px; }

/* Stat tiles (mirror the Android dashboard colors) */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden; border-radius: 18px; padding: 16px 18px; color: #fff; min-height: 112px;
  box-shadow: 0 10px 24px rgba(23, 26, 51, .12); animation: rise .4s ease both;
}
.stat::after { content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -40px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.stat .lb { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; opacity: .95; }
.stat .vl { font-size: 24px; font-weight: 700; margin: 8px 0 6px; letter-spacing: -.01em; }
.stat .ch { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: rgba(255, 255, 255, .9); color: #059669; }
.stat .ch.down { color: var(--red); }
.stat .ch.na { color: var(--muted); }
.s-purple { background: linear-gradient(135deg, #5b21b6, #8b5cf6); }
.s-green { background: linear-gradient(135deg, #059669, #34d399); }
.s-orange { background: linear-gradient(135deg, #ea580c, #fbbf24); }
.s-blue { background: linear-gradient(135deg, #1d4ed8, #38bdf8); }
.s-pink { background: linear-gradient(135deg, #db2777, #f472b6); }
.s-teal { background: linear-gradient(135deg, #0e7490, #22d3ee); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfbfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--bg-2); border: 1px solid var(--border); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.b-green { background: var(--green-soft); color: #047857; }
.b-orange { background: var(--orange-soft); color: #b45309; }
.b-blue { background: var(--blue-soft); color: #1d4ed8; }
.b-red { background: var(--red-soft); color: #be123c; }
.b-gray { background: var(--bg-2); color: var(--text-2); }
.b-purple { background: var(--primary-soft); color: var(--primary); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input { height: 38px; width: auto; min-width: 160px; }
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
.pager a, .pager span { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-2); text-decoration: none; }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Progress */
.progress { height: 12px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad); background-size: 200% 100%; transition: width .3s ease; animation: shimmer 1.4s linear infinite; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }

/* Footer credit */
.credit {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px;
  border-top: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2);
}
.credit img { height: 30px; width: auto; display: block; }
.credit a { color: var(--text-2); }

.team-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: 0; }
.team-row .sp { flex: 1; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-all; }

.overlay { position: fixed; inset: 0; background: rgba(23, 26, 51, .35); z-index: 25; display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }

@media (max-width: 1280px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 32px; }
  .credit { padding: 14px 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .auth-head, .auth-content, .auth-foot { padding-left: 20px; padding-right: 20px; }
  .user-chip .txt { display: none; }
  .kv { grid-template-columns: 1fr; }
  .credit { flex-direction: column; text-align: center; }
}
