:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e5eaf0;

  --text: #172033;
  --muted: #718096;

  --primary: #176b87;
  --primary-dark: #10546c;
  --primary-soft: #e8f4f7;

  --danger: #c53c3c;
  --success: #198754;
  --warning: #c98916;

  --sidebar: #102d3a;
  --sidebar-hover: #173d4d;

  --radius: 14px;
  --shadow:
    0 8px 30px rgba(15, 35, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}


/* LOGIN */

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

  background:
    radial-gradient(
      circle at top right,
      #d9f1f5,
      transparent 38%
    ),
    linear-gradient(
      135deg,
      #f7fafc,
      #edf4f7
    );
}

.login-card {
  width: 100%;
  max-width: 420px;

  background: var(--surface);

  padding: 42px;

  border-radius: 22px;

  box-shadow:
    0 25px 70px rgba(16, 45, 58, 0.14);
}

.brand-mark {
  width: 58px;
  height: 58px;

  border-radius: 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--primary);
  color: white;

  font-weight: 800;
  font-size: 25px;

  margin-bottom: 22px;
}

.brand-mark.small {
  width: 42px;
  height: 42px;

  min-width: 42px;

  margin: 0;

  border-radius: 12px;

  font-size: 19px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-subtitle {
  margin: 0 0 30px;
  color: var(--muted);
}

label {
  display: block;

  margin: 16px 0 7px;

  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;

  border: 1px solid var(--border);
  border-radius: 10px;

  padding: 12px 13px;

  outline: none;

  background: white;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);

  box-shadow:
    0 0 0 3px rgba(23, 107, 135, 0.1);
}

.primary-button {
  width: 100%;

  margin-top: 24px;
  padding: 13px 18px;

  border: 0;
  border-radius: 10px;

  background: var(--primary);
  color: white;

  font-weight: 700;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.form-error {
  margin-top: 15px;

  padding: 10px 12px;

  background: #fff0f0;
  color: var(--danger);

  border-radius: 8px;

  font-size: 13px;
}


/* LAYOUT */

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

.sidebar {
  width: 250px;
  min-width: 250px;

  background: var(--sidebar);
  color: white;

  display: flex;
  flex-direction: column;

  position: fixed;

  left: 0;
  top: 0;
  bottom: 0;

  z-index: 20;
}

.sidebar-brand {
  height: 82px;

  padding: 18px;

  display: flex;
  align-items: center;
  gap: 12px;

  border-bottom:
    1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong {
  display: block;
}

.sidebar-brand span {
  display: block;

  margin-top: 2px;

  color: rgba(255, 255, 255, 0.6);

  font-size: 12px;
}

.menu {
  flex: 1;

  padding: 18px 12px;

  overflow-y: auto;
}

.menu-item {
  width: 100%;

  border: 0;

  background: transparent;
  color: rgba(255, 255, 255, 0.76);

  display: flex;
  align-items: center;
  gap: 11px;

  padding: 12px 13px;
  margin-bottom: 4px;

  border-radius: 9px;

  text-align: left;
}

.menu-item:hover,
.menu-item.active {
  background: var(--sidebar-hover);
  color: white;
}

.menu-item.active {
  box-shadow:
    inset 3px 0 0 #5fc1d8;
}

.menu-item small {
  margin-left: auto;

  font-size: 10px;

  color: rgba(255, 255, 255, 0.42);
}

.menu-item.disabled {
  opacity: 0.5;
  cursor: default;
}

.menu-separator {
  height: 1px;

  margin: 15px 8px;

  background:
    rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  padding: 18px;

  border-top:
    1px solid rgba(255, 255, 255, 0.08);

  color: rgba(255, 255, 255, 0.5);

  font-size: 12px;

  display: flex;
  justify-content: space-between;
}

.main {
  width: calc(100% - 250px);

  margin-left: 250px;

  min-height: 100vh;
}

.topbar {
  height: 82px;

  background: white;

  border-bottom: 1px solid var(--border);

  padding: 0 28px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  position: sticky;
  top: 0;

  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar h2 {
  margin: 0;

  font-size: 20px;
}

#page-subtitle {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 12px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;

  border-radius: 50%;

  background: var(--primary-soft);
  color: var(--primary);

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 800;
  font-size: 13px;
}

.user-data strong {
  display: block;

  font-size: 13px;
}

.user-data span {
  display: block;

  margin-top: 2px;

  color: var(--muted);

  font-size: 11px;
}

.logout-button {
  margin-left: 8px;

  border: 1px solid var(--border);
  border-radius: 8px;

  padding: 8px 12px;

  background: white;

  color: var(--muted);
}

.content {
  padding: 28px;
}


/* CARDS */

.cards {
  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 18px;
}

.stat-card {
  background: white;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  padding: 20px;

  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);

  font-size: 12px;
  font-weight: 700;

  text-transform: uppercase;
}

.stat-value {
  display: block;

  margin-top: 8px;

  font-size: 30px;
  font-weight: 800;
}

.panel {
  margin-top: 22px;

  background: white;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  box-shadow: var(--shadow);

  overflow: hidden;
}

.panel-header {
  min-height: 64px;

  padding: 15px 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;

  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  margin: 0;

  font-size: 16px;
}

.panel-body {
  padding: 18px;
}

.action-button {
  border: 0;
  border-radius: 8px;

  padding: 9px 13px;

  background: var(--primary);
  color: white;

  font-weight: 700;
  font-size: 12px;
}

.secondary-button {
  border: 1px solid var(--border);
  border-radius: 8px;

  padding: 9px 13px;

  background: white;

  font-weight: 600;
}


/* TABLE */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;

  border-collapse: collapse;
}

th {
  padding: 11px 12px;

  color: var(--muted);

  font-size: 11px;
  text-transform: uppercase;

  text-align: left;

  background: var(--surface-soft);
}

td {
  padding: 13px 12px;

  border-top: 1px solid var(--border);

  font-size: 13px;
}

.badge {
  display: inline-flex;

  padding: 5px 8px;

  border-radius: 20px;

  font-size: 10px;
  font-weight: 800;
}

.badge.active {
  background: #e9f7ef;
  color: var(--success);
}

.badge.inactive {
  background: #f3f4f6;
  color: #737b87;
}

.empty-state {
  padding: 45px 20px;

  text-align: center;

  color: var(--muted);
}


/* MODAL */

.modal-overlay {
  position: fixed;
  inset: 0;

  z-index: 100;

  background:
    rgba(9, 25, 34, 0.55);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 650px;

  max-height: 90vh;

  background: white;

  border-radius: 16px;

  overflow: auto;

  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 18px 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  border: 0;
  background: transparent;

  font-size: 25px;

  color: var(--muted);
}

.modal-content {
  padding: 20px;
}

.form-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 0 16px;
}

.form-full {
  grid-column: 1 / -1;
}


/* TOAST */

.toast {
  position: fixed;

  right: 24px;
  bottom: 24px;

  z-index: 200;

  max-width: 360px;

  padding: 13px 17px;

  border-radius: 10px;

  background: #172033;
  color: white;

  box-shadow: var(--shadow);
}


/* MOBILE */

.mobile-only {
  display: none;
}

.icon-button {
  border: 0;
  background: transparent;

  font-size: 22px;
}

@media (max-width: 1000px) {

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

}

@media (max-width: 760px) {

  .sidebar {
    transform: translateX(-100%);
    transition: 0.25s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-only {
    display: block;
  }

  .topbar {
    padding: 0 16px;
  }

  .user-data {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

}
