/* Minimal modern UI (LAN-friendly, no external CDN) */
:root {
  --bg: #0b1020;
  --panel: #0f1730;
  --card: #111c38;
  --muted: #8aa0c2;
  --text: #e7eefc;
  --line: rgba(255, 255, 255, .08);
  --accent: #6aa3ff;
  --accent2: #7c5cff;
  --danger: #ff5c7a;
  --ok: #2fe1a5;
  --warn: #ffc44d;
  --shadow: 0 12px 40px rgba(0, 0, 0, .35);
  --radius: 20px;
  /* Increased radius */
  --radius-sm: 14px;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: 15px;
  /* Base font size increased */
  background: radial-gradient(1100px 600px at 15% 0%, rgba(124, 92, 255, .35), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(106, 163, 255, .28), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  color-scheme: dark;
  accent-color: var(--accent);
}

a {
  color: var(--accent);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

.container {
  max-width: 1600px;
  /* Wider container */
  margin: 0 auto;
  padding: 30px;
  /* Increased padding */
}

.grid {
  display: grid;
  gap: 20px;
  /* Increased gap */
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr))
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr))
}

@media (max-width: 900px) {

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr
  }

  .container {
    padding: 16px
  }
}

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

.sidebar {
  width: 280px;
  /* Wider sidebar */
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .00));
  padding: 24px 18px;
  /* Increased padding */
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 980px) {
  .sidebar {
    display: none
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
  flex-shrink: 0;
  margin-bottom: 20px;
}

.brand-badge {
  width: 44px;
  /* Larger badge */
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  box-shadow: var(--shadow);
}

.brand h1 {
  font-size: 16px;
  /* Larger text */
  margin: 0;
  line-height: 1.1;
  font-weight: 700;
}

.brand p {
  margin: 0;
  font-size: 13px;
  color: var(--muted)
}

.nav {
  /* margin-top: 14px; removed since brand has margin-bottom */
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* More spacing */
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  padding-bottom: 20px;
}

.nav::-webkit-scrollbar {
  width: 4px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}


.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  /* Larger touch targets */
  border-radius: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  flex-shrink: 0;
  font-size: 15px;
  /* Larger font */
}

.nav a:hover {
  background: rgba(255, 255, 255, .04);
  text-decoration: none
}

.nav a.active {
  background: rgba(106, 163, 255, .12);
  border-color: rgba(106, 163, 255, .22);
  font-weight: 600;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px;
  /* Larger header */
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, .15);
  /* Slightly darker */
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

@media (max-width: 980px) {
  .topbar {
    padding: 16px 20px
  }
}

.title {
  display: flex;
  flex-direction: column;
  gap: 4px
}

.title h2 {
  margin: 0;
  font-size: 20px;
  /* Larger title */
  font-weight: 700;
}

.title .sub {
  color: var(--muted);
  font-size: 14px
}

.userpill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  /* Larger pill */
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  transition: all 0.2s;
}

.userpill:hover {
  background: rgba(255, 255, 255, .08);
}

.userpill .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(47, 225, 165, .12);
}

.sidebar>.card {
  flex-shrink: 0;
}

.card {
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  /* Increased padding */
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}

.card h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.kpi {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px
}

.kpi .num {
  font-size: 42px;
  /* Much larger numbers */
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.kpi .meta {
  color: var(--muted);
  font-size: 14px
}

.table {
  width: 100%;
  border-collapse: separate;
  /* Changed for border radius */
  border-spacing: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.table th,
.table td {
  padding: 16px 20px;
  /* More padding */
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 15px;
  /* Larger table text */
}

.table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, .03);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: rgba(255, 255, 255, .02)
}

.table td.actions {
  white-space: nowrap
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  /* Larger badge */
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}

.badge.ok {
  border-color: rgba(47, 225, 165, .25);
  background: rgba(47, 225, 165, .10);
  color: #5fffcb;
}

.badge.warn {
  border-color: rgba(255, 196, 77, .25);
  background: rgba(255, 196, 77, .10);
  color: #ffda7f;
}

.badge.danger {
  border-color: rgba(255, 92, 122, .25);
  background: rgba(255, 92, 122, .10);
  color: #ff8b9f;
}

.badge.info {
  border-color: rgba(106, 163, 255, .25);
  background: rgba(106, 163, 255, .10);
  color: #9ec5ff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  /* Larger buttons */
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  background: rgba(255, 255, 255, .08);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  border-color: rgba(106, 163, 255, .4);
  background: linear-gradient(135deg, rgba(124, 92, 255, .4), rgba(106, 163, 255, .25));
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn.danger {
  border-color: rgba(255, 92, 122, .35);
  background: rgba(255, 92, 122, .10);
}

.btn.small {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px
}

.input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  /* Larger inputs */
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-size: 15px;
  /* Larger text in inputs */
  outline: none;
  transition: all 0.2s;
}

.input:focus,
select:focus,
textarea:focus {
  background: rgba(255, 255, 255, .06);
  border-color: var(--accent);
}

textarea {
  min-height: 120px;
  resize: vertical
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin: 0 0 8px 4px
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px
    /* Increased gap */
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px
}

@media (max-width: 900px) {

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr
  }
}

.hr {
  height: 1px;
  background: var(--line);
  margin: 20px 0
}

.alert {
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-size: 14px;
}

/* Alert variants remain same but inherit new padding */
.alert.ok {
  border-color: rgba(47, 225, 165, .25);
  background: rgba(47, 225, 165, .08)
}

.alert.warn {
  border-color: rgba(255, 196, 77, .25);
  background: rgba(255, 196, 77, .08)
}

.alert.danger {
  border-color: rgba(255, 92, 122, .25);
  background: rgba(255, 92, 122, .08)
}

.alert.success {
  border-color: rgba(47, 225, 165, .25);
  background: rgba(47, 225, 165, .08)
}

.alert.err {
  border-color: rgba(255, 92, 122, .25);
  background: rgba(255, 92, 122, .08)
}

.alert.error {
  border-color: rgba(255, 92, 122, .25);
  background: rgba(255, 92, 122, .08)
}

.alert.info {
  border-color: rgba(120, 170, 255, .25);
  background: rgba(120, 170, 255, .08)
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(480px, 100%);
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
}

.login-card p {
  margin: 0 0 20px 0;
  color: var(--muted);
  font-size: 14px
}

.print-only {
  display: none
}

@media print {
  body {
    background: #fff;
    color: #000
  }

  .sidebar,
  .topbar,
  .no-print {
    display: none !important
  }

  .main {
    padding: 0
  }

  .card,
  .table {
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .print-only {
    display: block
  }
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 120%;
  right: 0;
  width: 200px;
  background: #151b2e;
  /* Solid background for dropdown */
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-menu a {
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu a:last-child {
  border-bottom: none;
}


/* Modal Styling */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 2147483647 !important;
  /* Max z-index */
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 30px;
  border-radius: 20px;
  width: min(500px, 90%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.15s ease-out;
}

.modal-overlay.open .modal-card {
  transform: scale(1);
  opacity: 1;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}