:root {
  --gv-navy: #0f3a6d;
  --gv-blue: #1a5dab;
  --gv-blue-mid: #2f7fd1;
  --gv-blue-soft: #5aa3e8;
  --gv-sky: #e8f2fb;
  --gv-red: #e53935;
  --gv-red-dark: #c62828;
  --gv-gray: #6b7c93;
  --gv-gray-card: #8a97a8;
  --gv-bg: #eef3f8;
  --gv-white: #ffffff;
  --gv-text: #1e2a3a;
  --gv-muted: #6b7c93;
  --gv-sidebar: 72px;
  --gv-header: 64px;
  --gv-radius: 14px;
  --gv-shadow: 0 8px 24px rgba(15, 58, 109, 0.08);
}

* { box-sizing: border-box; }

body.app-body {
  margin: 0;
  font-family: "Segoe UI", "Nunito Sans", Inter, system-ui, sans-serif;
  background: var(--gv-bg);
  color: var(--gv-text);
  min-height: 100vh;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-left {
  position: relative;
  background: linear-gradient(160deg, #0d3b74 0%, #1a5dab 45%, #2a74c4 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  overflow: hidden;
}

.login-left::before,
.login-left::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.login-left::before {
  width: 420px;
  height: 420px;
  bottom: -120px;
  left: -80px;
}

.login-left::after {
  width: 280px;
  height: 280px;
  top: -60px;
  right: -40px;
  background: rgba(255, 255, 255, 0.04);
}

.login-wave {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.08), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(90,163,232,.25), transparent 35%);
  pointer-events: none;
}

.login-form-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
}

.login-form-wrap h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.2;
}

.login-form-wrap .subtitle {
  opacity: .85;
  margin-bottom: 36px;
}

.login-form-wrap .form-control {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.login-form-wrap .form-control.password-field {
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: none;
}

.login-form-wrap .form-control.password-field::placeholder {
  color: rgba(255,255,255,.7);
}

.login-form-wrap .form-control.password-field:focus {
  background: rgba(255,255,255,.22);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.15);
}

.login-form-wrap label {
  color: rgba(255,255,255,.9);
  font-size: 13px;
  margin-bottom: 8px;
}

.btn-login {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--gv-red);
  color: #fff;
  font-weight: 700;
  padding: 14px 20px;
  margin-top: 8px;
  transition: .2s;
}

.btn-login:hover {
  background: var(--gv-red-dark);
  color: #fff;
  transform: translateY(-1px);
}

.login-right {
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  position: relative;
}

.login-brand-mark {
  position: absolute;
  top: 28px;
  right: 36px;
  text-align: right;
}

.login-brand-mark .logo-text {
  font-weight: 800;
  color: var(--gv-blue);
  letter-spacing: .04em;
  font-size: 14px;
}

.login-brand-mark .tagline {
  font-size: 11px;
  color: var(--gv-muted);
}

.login-hero-art {
  width: min(420px, 90%);
  margin: 40px auto;
}

.login-product-name {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--gv-blue);
  letter-spacing: -.02em;
  margin: 0;
}

.login-alert {
  border: 0;
  border-radius: 12px;
  background: rgba(229,57,53,.15);
  color: #fff;
  font-size: 14px;
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--gv-sidebar);
  background: linear-gradient(180deg, #0d3b74, #154a8a);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  box-shadow: 4px 0 20px rgba(15,58,109,.18);
}

.sidebar-brand {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  margin-bottom: 28px;
  font-size: 24px;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav a {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 22px;
  position: relative;
  transition: .2s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--gv-red);
  color: #fff;
  box-shadow: 0 8px 18px rgba(229,57,53,.35);
}

.sidebar-nav a .tooltip-label {
  position: absolute;
  left: calc(100% + 12px);
  background: #0f3a6d;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
  transition: .15s;
  z-index: 20;
}

.sidebar-nav a:hover .tooltip-label {
  opacity: 1;
  transform: none;
}

.sidebar-foot {
  margin-top: auto;
  padding-bottom: 8px;
}

.app-main {
  margin-left: var(--gv-sidebar);
  flex: 1;
  min-width: 0;
}

.top-header {
  height: var(--gv-header);
  background: #fff;
  border-bottom: 1px solid #e3ebf3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.top-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gv-text);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gv-muted);
  font-size: 13px;
  font-weight: 600;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.env-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  white-space: nowrap;
}

.env-banner .env-detail {
  font-weight: 600;
  opacity: .9;
}

.env-banner i {
  font-size: 16px;
}

.env-local {
  background: #e8f2fb;
  color: #0f3a6d;
  border: 1px solid #b7d4f0;
}

.env-vps {
  background: #fdecea;
  color: #c62828;
  border: 1px solid #f5c2c0;
}

.login-env-banner {
  width: 100%;
  border-radius: 12px;
  padding: 10px 14px;
  white-space: normal;
}

.login-env-banner small {
  display: block;
  font-weight: 600;
  opacity: .85;
  margin-top: 2px;
}

.login-env-banner.env-local {
  background: rgba(232, 242, 251, .18);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}

.login-env-banner.env-vps {
  background: rgba(229, 57, 53, .22);
  color: #fff;
  border-color: rgba(255,255,255,.28);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gv-text);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gv-blue), var(--gv-blue-soft));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.page-wrapper {
  padding: 24px 28px 36px;
}

.card-panel {
  background: #fff;
  border: 0;
  border-radius: var(--gv-radius);
  box-shadow: var(--gv-shadow);
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.page-toolbar .form-select,
.page-toolbar .form-control {
  border-radius: 10px;
  border-color: #d7e2ee;
  min-width: 160px;
  font-size: 14px;
}

.btn-accent {
  background: var(--gv-red);
  border-color: var(--gv-red);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  padding: 10px 18px;
}

.btn-accent:hover {
  background: var(--gv-red-dark);
  border-color: var(--gv-red-dark);
  color: #fff;
}

.btn-navy {
  background: var(--gv-blue);
  border-color: var(--gv-blue);
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
}

.btn-navy:hover {
  background: var(--gv-navy);
  border-color: var(--gv-navy);
  color: #fff;
}

/* ---------- Metric cards ---------- */
.metric-card {
  border-radius: 16px;
  padding: 20px 22px;
  color: #fff;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--gv-shadow);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -24px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}

.metric-card .metric-label {
  font-size: 13px;
  opacity: .9;
  font-weight: 600;
}

.metric-card .metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.metric-card .metric-icon {
  position: absolute;
  right: 18px;
  top: 18px;
  font-size: 28px;
  opacity: .85;
}

.metric-red { background: linear-gradient(135deg, #e53935, #c62828); }
.metric-navy { background: linear-gradient(135deg, #0f3a6d, #1a5dab); }
.metric-blue { background: linear-gradient(135deg, #2f7fd1, #5aa3e8); }
.metric-gray { background: linear-gradient(135deg, #7b8b9e, #9aa8b8); }
.metric-teal { background: linear-gradient(135deg, #00897b, #26a69a); }

.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--gv-text);
}

.quick-tile {
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--gv-shadow);
  padding: 22px;
  height: 100%;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: .2s;
}

.quick-tile:hover {
  transform: translateY(-2px);
  color: inherit;
  box-shadow: 0 12px 28px rgba(15,58,109,.12);
}

.quick-tile .tile-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  margin-bottom: 14px;
}

.tile-red { background: var(--gv-red); }
.tile-navy { background: var(--gv-navy); }
.tile-blue { background: var(--gv-blue-mid); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok { background: #e8f7ef; color: #1b7a45; }
.status-pill.warn { background: #fff3e8; color: #b65c12; }
.status-pill.danger { background: #fdecea; color: #c62828; }

/* ---------- Tables ---------- */
.table-shell {
  background: #fff;
  border-radius: var(--gv-radius);
  box-shadow: var(--gv-shadow);
  overflow: hidden;
}

.table-shell .table {
  margin: 0;
  font-size: 14px;
}

.table-shell thead th {
  background: #f7fafc;
  border-bottom: 1px solid #e6eef6;
  color: var(--gv-muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 14px 16px;
  white-space: nowrap;
}

.table-shell tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  border-color: #eef3f8;
}

.table-shell tbody tr:hover {
  background: #f8fbfe;
}

.badge-working {
  background: #fdecea;
  color: var(--gv-red);
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 10px;
}

.form-control, .form-select {
  border-radius: 10px;
  border-color: #d7e2ee;
}

.form-control:focus, .form-select:focus {
  border-color: var(--gv-blue-soft);
  box-shadow: 0 0 0 3px rgba(42,116,196,.15);
}

.nav-tabs .nav-link {
  border: 0;
  color: var(--gv-muted);
  font-weight: 700;
  border-radius: 10px 10px 0 0;
}

.nav-tabs .nav-link.active {
  color: var(--gv-blue);
  background: #fff;
  box-shadow: var(--gv-shadow);
}

/* ---------- Modals ---------- */
.modal {
  --bs-modal-border-radius: 16px;
  --bs-modal-border-color: transparent;
}

.modal-dialog {
  margin: 1.75rem auto;
}

.modal-dialog-centered {
  min-height: calc(100% - 3.5rem);
}

.modal-content {
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 58, 109, 0.28);
  background: #fff;
}

.modal-header {
  background: linear-gradient(135deg, #0f3a6d 0%, #1a5dab 100%);
  color: #fff;
  border-bottom: 0;
  padding: 16px 22px;
  align-items: center;
}

.modal-header .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: #fff;
  margin: 0;
}

.modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
  opacity: .85;
  margin: 0;
  padding: 0;
  box-shadow: none;
}

.modal-header .btn-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 22px;
  background: #fff;
}

.modal-body .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gv-muted);
  margin-bottom: 6px;
}

.modal-footer {
  background: #f3f7fb;
  border-top: 1px solid #e6eef6;
  padding: 14px 22px;
  gap: 10px;
  justify-content: flex-end;
}

.modal-footer .btn {
  border-radius: 10px;
  font-weight: 700;
  min-width: 110px;
  padding: 9px 16px;
}

.modal-footer .btn-light,
.modal-footer .btn-secondary {
  background: #fff;
  border: 1px solid #d7e2ee;
  color: var(--gv-text);
}

.modal-footer .btn-light:hover,
.modal-footer .btn-secondary:hover {
  background: #eef3f8;
  border-color: #c5d4e4;
  color: var(--gv-text);
}

.modal-backdrop.show {
  opacity: .55;
  background: #0a2748;
}

@media (max-width: 992px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .sidebar { width: 64px; }
  .app-main { margin-left: 64px; }
  .page-wrapper { padding: 16px; }
  .top-header { padding: 0 16px; }
}

@media print {
  .sidebar, .top-header, .no-print { display: none !important; }
  .app-main { margin-left: 0; }
  .page-wrapper { padding: 0; }
}
