:root {
  --bg: #f7f3ff;
  --panel: rgba(255, 255, 255, .88);
  --panel-solid: #ffffff;
  --ink: #171227;
  --muted: #766f8a;
  --line: rgba(111, 86, 150, .18);
  --accent: #ff3d7f;
  --accent-dark: #d91f62;
  --violet: #7c3cff;
  --cyan: #00b8d9;
  --lime: #2ccf7b;
  --danger: #ef335f;
  --warning: #ff9f1c;
  --ok: #18b26b;
  --sidebar: #1b1230;
  --shadow: 0 18px 46px rgba(70, 38, 124, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 61, 127, .18), transparent 26%),
    radial-gradient(circle at 82% 4%, rgba(0, 184, 217, .18), transparent 28%),
    linear-gradient(135deg, #fff7fb 0%, #f3f7ff 45%, #f8f2ff 100%);
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: 292px 1fr; min-height: 100vh; }

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 61, 127, .16), transparent 22%),
    linear-gradient(160deg, #231642 0%, #151222 58%, #101827 100%);
  color: #f7fbff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid rgba(255, 255, 255, .1);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: white;
  font-size: 20px;
  box-shadow: 0 14px 26px rgba(255, 61, 127, .35);
}
.brand-title { font-size: 18px; font-weight: 900; letter-spacing: 0; }
.brand-subtitle, .muted { color: var(--muted); font-size: 13px; font-weight: 600; }
.sidebar .muted, .brand-subtitle { color: #bfb6d4; }

.nav { display: grid; gap: 10px; }
.nav-item {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .04);
  color: #efe9ff;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
}
.nav-item i { width: 20px; color: #ffcf5a; text-align: center; }
.nav-item:hover, .nav-item.active {
  background: linear-gradient(135deg, rgba(255, 61, 127, .95), rgba(124, 60, 255, .95));
  border-color: rgba(255, 255, 255, .22);
  color: #fff;
  box-shadow: 0 12px 26px rgba(124, 60, 255, .25);
}
.nav-item:hover i, .nav-item.active i { color: #fff; }

.auth-panel { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 16px; }
.auth-state { margin-top: 6px; font-weight: 800; color: #fff; }
.main { min-width: 0; padding: 28px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.title-wrap { display: flex; align-items: center; gap: 16px; min-width: 0; }
.title-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 16px 30px rgba(0, 184, 217, .26);
  font-size: 22px;
  order: 2;
}
h1, h2, p { margin: 0; }
h1 { font-size: 30px; font-weight: 900; letter-spacing: 0; }
h2 { font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 9px; }
h2 i { color: var(--accent); }
#viewSubtitle { color: var(--muted); margin-top: 5px; font-weight: 600; }

.top-actions { display: flex; gap: 10px; align-items: center; }
.search-wrap { position: relative; }
.search-wrap i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--violet);
  pointer-events: none;
}
.search, .input, .select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  padding: 11px 13px;
  color: var(--ink);
  outline: none;
  box-shadow: 0 8px 22px rgba(70, 38, 124, .06);
}
.search { width: min(440px, 42vw); padding-left: 40px; }
.search:focus, .input:focus, .select:focus, textarea:focus {
  border-color: rgba(124, 60, 255, .55);
  box-shadow: 0 0 0 4px rgba(124, 60, 255, .12);
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 15px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: white;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 24px rgba(255, 61, 127, .24);
}
.btn:hover { filter: brightness(.97) saturate(1.1); transform: translateY(-1px); }
.btn.secondary {
  background: linear-gradient(135deg, #ffffff, #f0eaff);
  color: #38245f;
  border: 1px solid rgba(124, 60, 255, .18);
  box-shadow: 0 10px 20px rgba(70, 38, 124, .08);
}
.btn.danger { background: linear-gradient(135deg, #ff4d6d, #d9045f); }
.btn.warning { background: linear-gradient(135deg, #ffbd2e, #ff7a00); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.view { display: grid; gap: 16px; }
.hidden { display: none !important; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}
.stat-card, .panel, .login-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.stat-card {
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 61, 127, .22), rgba(0, 184, 217, .18));
}
.stat-card:nth-child(2n)::after { background: linear-gradient(135deg, rgba(124, 60, 255, .22), rgba(44, 207, 123, .18)); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 800; position: relative; z-index: 1; }
.stat-value { font-size: 28px; font-weight: 900; margin-top: 7px; position: relative; z-index: 1; }
.panel { padding: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.segmented {
  display: flex;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .82);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(70, 38, 124, .08);
}
.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 11px 13px;
  cursor: pointer;
  font-weight: 800;
  color: #51446d;
}
.segmented button:last-child { border-right: 0; }
.segmented button.active {
  background: linear-gradient(135deg, rgba(255, 61, 127, .14), rgba(124, 60, 255, .15));
  color: var(--accent-dark);
}
.segmented i { margin-right: 6px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(360px, .8fr);
  gap: 16px;
  align-items: start;
}
.table { display: grid; gap: 9px; }
.row {
  display: grid;
  grid-template-columns: 74px 1fr 130px 118px;
  gap: 10px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(124, 60, 255, .14);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, .86);
}
.row:hover, .row.active {
  border-color: rgba(255, 61, 127, .48);
  background: linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(255, 239, 247, .92));
  box-shadow: 0 12px 28px rgba(255, 61, 127, .12);
}
.row strong { color: var(--violet); }
.row-title { font-weight: 900; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #efeaff;
  color: #553397;
}
.badge.pending { background: #fff1c7; color: #986100; }
.badge.approved, .badge.paid { background: #dffbea; color: #0e7648; }
.badge.rejected, .badge.cancelled { background: #ffe1e9; color: #b0163d; }

.detail-panel { position: sticky; top: 18px; }
.detail-empty { color: var(--muted); padding: 24px; text-align: center; font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.field {
  border: 1px solid rgba(124, 60, 255, .14);
  border-radius: 8px;
  padding: 11px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(248, 245, 255, .9));
}
.field-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.field-value { font-weight: 800; margin-top: 4px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.screenshot {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid rgba(124, 60, 255, .16);
  border-radius: 8px;
  background: #fff;
  margin-top: 12px;
}
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; color: var(--muted); font-weight: 800; gap: 10px; }
.servers-grid, .server-stat-list { display: grid; gap: 10px; }
.server-card, .server-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(124, 60, 255, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
}
.server-card strong, .server-stat strong { font-weight: 900; }

.switch {
  width: 52px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #c7bdd8;
  padding: 4px;
  cursor: pointer;
}
.switch span { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.switch.on { background: linear-gradient(135deg, var(--lime), var(--cyan)); }
.switch.on span { transform: translateX(22px); }
.login-card { padding: 22px; max-width: 620px; }
.login-card p { color: var(--muted); margin: 8px 0 14px; font-weight: 600; }
.login-row { display: flex; gap: 10px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: linear-gradient(135deg, #1b1230, #33215b);
  color: white;
  padding: 13px 15px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: .18s ease;
  pointer-events: none;
  max-width: 420px;
  font-weight: 800;
}
.toast.show { opacity: 1; transform: translateY(0); }
textarea { width: 100%; min-height: 86px; resize: vertical; margin-top: 10px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; padding: 12px; }
  .nav { grid-template-columns: repeat(4, 1fr); }
  .nav-item { justify-content: center; padding: 10px 6px; }
  .auth-panel { display: none; }
  .topbar, .top-actions { align-items: stretch; flex-direction: column; }
  .title-wrap { justify-content: space-between; }
  .search { width: 100%; }
  .stats-grid, .content-grid { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
}

@media (max-width: 620px) {
  .main { padding: 16px; }
  .brand { display: none; }
  .nav-item span { display: none; }
  .row { grid-template-columns: 54px 1fr; }
  .row > :nth-child(3), .row > :nth-child(4) { grid-column: 2; }
  .detail-grid { grid-template-columns: 1fr; }
  .segmented { width: 100%; overflow-x: auto; }
  .login-row { flex-direction: column; }
  .title-icon { width: 46px; height: 46px; }
}
