/* ============================================================
   Unipro Master Control Panel — premium dark navy / gold theme
   Single stylesheet, no external CDNs (offline-safe).
   Palette: bg #0B1626 / #0F1E33 · cards #16283F ·
            gold #D4A017 / #E8B93C · text #F4F8FB ·
            muted #A8BAC8 · borders #2E4A66
   ============================================================ */

:root {
  --bg:      #0B1626;
  --bg2:     #0F1E33;
  --card:    #16283F;
  --card2:   #1B3049;
  --gold:    #D4A017;
  --gold2:   #E8B93C;
  --text:    #F4F8FB;
  --muted:   #A8BAC8;
  --border:  #2E4A66;
  --green:   #2FD47A;
  --red:     #F05555;
  --amber:   #F5A623;
  --radius:  14px;
  --shadow:  0 10px 30px rgba(0, 0, 0, .35);
  --font:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(212, 160, 23, .07), transparent 60%),
    linear-gradient(180deg, var(--bg2), var(--bg) 40%);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.muted { color: var(--muted); }

/* ---------------- App shell ---------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0E1B30 0%, #0A1424 100%);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px 16px;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong {
  font-size: 18px;
  letter-spacing: .22em;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: .08em; }

/* CSS-only dotted logo mark (no images) */
.logo-dots {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-image: radial-gradient(circle, var(--gold2) 2.4px, transparent 3px);
  background-size: 12px 12px;
  background-position: center;
  border: 2px solid var(--gold);
  box-shadow: 0 0 26px rgba(212, 160, 23, .35), inset 0 0 18px rgba(212, 160, 23, .15);
  flex-shrink: 0;
}
.logo-dots-sm { width: 38px; height: 38px; background-size: 9px 9px; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .18s ease;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav a.active {
  color: var(--gold2);
  background: rgba(212, 160, 23, .10);
  border-left-color: var(--gold);
}
.nav-ico { font-size: 17px; width: 24px; text-align: center; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  color: #1a1206; font-weight: 800; font-size: 15px;
  flex-shrink: 0;
}
.admin-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.admin-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-meta span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 40px;
  max-width: 1240px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 26px; letter-spacing: .01em; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

.page-foot {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  letter-spacing: .06em;
}

.section-title {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--gold2);
  margin: 28px 0 14px;
}

/* ---------------- Cards & grids ---------------- */

.card {
  background: linear-gradient(180deg, var(--card), #13253D);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: linear-gradient(180deg, var(--card), #13253D);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .18s ease, border-color .18s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(212, 160, 23, .45); }

.stat-ico {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
  background: rgba(212, 160, 23, .12);
  border: 1px solid rgba(212, 160, 23, .35);
  flex-shrink: 0;
}
.stat-num { font-size: 24px; font-weight: 800; letter-spacing: .01em; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.panel-card {
  background: linear-gradient(180deg, var(--card), #13253D);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent, var(--gold));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .18s ease;
}
.panel-card:hover { transform: translateY(-2px); }

.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-top h3 { font-size: 16.5px; }
.panel-desc { font-size: 13px; color: var(--muted); }
.panel-url { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.panel-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.mini-stats { margin: 2px 0 4px; }
.mini-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-top: 1px dashed var(--border);
  font-size: 13px;
}
.mini-stats dt { color: var(--muted); }
.mini-stats dd { font-weight: 700; }

.panel-actions { margin-top: auto; padding-top: 6px; display: flex; gap: 10px; }

/* ---------------- Status indicators ---------------- */

.status-dot {
  width: 11px; height: 11px; border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.status-dot.up   { background: var(--green); box-shadow: 0 0 10px rgba(47, 212, 122, .8); animation: pulse 2s infinite; }
.status-dot.down { background: var(--red);   box-shadow: 0 0 10px rgba(240, 85, 85, .8); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

.status-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  white-space: nowrap;
}
.status-pill.up, .status-pill.active {
  color: #7BF0A8; border-color: rgba(47, 212, 122, .5); background: rgba(47, 212, 122, .10);
}
.status-pill.down, .status-pill.suspended, .status-pill.inactive {
  color: #FF9D9D; border-color: rgba(240, 85, 85, .5); background: rgba(240, 85, 85, .10);
}
.status-pill.pending {
  color: #FFD48A; border-color: rgba(245, 166, 35, .5); background: rgba(245, 166, 35, .10);
}

.chip {
  font-size: 12px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--gold2);
  border: 1px solid rgba(212, 160, 23, .5);
  background: rgba(212, 160, 23, .10);
  white-space: nowrap;
}

/* ---------------- Buttons & forms ---------------- */

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  color: #1a1206;
  font-weight: 800;
  font-size: 14.5px;
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(212, 160, 23, .30);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  white-space: nowrap;
}
.btn-gold:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 8px 22px rgba(212, 160, 23, .40); }
.btn-gold:active { transform: translateY(0); }
.btn-gold:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--gold); background: rgba(212, 160, 23, .08); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 13px; border-radius: 9px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .03em; }

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], select, textarea {
  width: 100%;
  background: #0E1B30;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #5E7285; }
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, .18);
}

/* ---------------- Flash messages ---------------- */

.flash-wrap {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(480px, 92vw);
}
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: slideDown .25s ease;
}
.flash-error   { background: rgba(240, 85, 85, .14);  border: 1px solid rgba(240, 85, 85, .55);  color: #FFB4B4; }
.flash-success { background: rgba(47, 212, 122, .12); border: 1px solid rgba(47, 212, 122, .5);  color: #8FF2B4; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Auth pages (login / setup) ---------------- */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(212, 160, 23, .10), transparent 60%),
    linear-gradient(180deg, var(--bg2), var(--bg) 55%);
}

.auth-wrap { width: 100%; display: grid; place-items: center; gap: 18px; }

.auth-card {
  width: min(430px, 94vw);
  background: linear-gradient(180deg, var(--card), #12253C);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow), 0 0 60px rgba(212, 160, 23, .06);
  padding: 38px 34px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold2), var(--gold), transparent);
}

.auth-title {
  font-size: 26px;
  letter-spacing: .30em;
  margin: 18px 0 2px;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-indent: .30em;
}
.auth-sub { color: var(--muted); font-size: 13.5px; letter-spacing: .06em; margin-bottom: 24px; }

.auth-form { text-align: left; margin-top: 6px; }
.auth-form .flash { margin-bottom: 18px; text-align: center; }
.auth-foot { color: var(--muted); font-size: 12px; letter-spacing: .08em; }

/* ---------------- Search ---------------- */

.search-form {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.search-form input[type="search"] {
  font-size: 16px;
  padding: 14px 18px;
  border-radius: 12px;
}
.search-meta { margin-bottom: 14px; font-size: 13.5px; }

/* ---------------- Tables ---------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), #13253D);
  box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 12px 14px;
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table td strong { font-weight: 700; }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  background: rgba(255, 255, 255, .015);
}
.empty .empty-ico { font-size: 34px; display: block; margin-bottom: 12px; }

/* ---------------- Health ---------------- */

#health-list { display: flex; flex-direction: column; gap: 12px; }

.health-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--card), #13253D);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.health-main { display: flex; flex-direction: column; min-width: 200px; flex: 1; }
.health-main strong { font-size: 15px; }
.health-main .muted { font-size: 12.5px; word-break: break-all; }
.health-detail { flex-basis: 100%; font-size: 12.5px; padding-top: 2px; }

/* ---------------- Activity feed ---------------- */

.activity { list-style: none; display: flex; flex-direction: column; }
.activity li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.activity li:last-child { border-bottom: 0; }
.act-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px;
  background: rgba(212, 160, 23, .10);
  border: 1px solid rgba(212, 160, 23, .30);
  flex-shrink: 0;
}
.activity p { margin-bottom: 2px; }
.activity .muted { font-size: 12px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand { border: 0; padding: 0; margin: 0; gap: 8px; }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 15px; }
  .logo-dots-sm { width: 30px; height: 30px; background-size: 8px 8px; }

  .nav {
    flex-direction: row;
    flex: 1;
    gap: 2px;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav a {
    white-space: nowrap;
    padding: 9px 12px;
    font-size: 13px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
  }
  .nav a.active { border-bottom-color: var(--gold); background: transparent; }
  .nav-ico { font-size: 15px; width: auto; }

  .sidebar-foot {
    margin: 0;
    padding: 0;
    border: 0;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .admin-chip .admin-meta { display: none; }
  .sidebar-foot .btn-ghost { padding: 8px 12px; font-size: 12.5px; }

  .main { padding: 18px 14px 34px; max-width: none; }
  .page-head h1 { font-size: 22px; }

  .panel-grid { grid-template-columns: 1fr; }
  .search-form { flex-direction: column; }
  .search-form .btn-gold { width: 100%; }
  .auth-card { padding: 30px 22px 26px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-ico { width: 40px; height: 40px; font-size: 18px; }
  .stat-num { font-size: 20px; }
}
