
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #174b85;
  --primary-dark: #10345e;
  --background: #f3f6fb;
  --surface: #ffffff;
  --text: #1d2939;
  --muted: #667085;
  --border: #e4e9f0;
  --success: #168653;
  --danger: #d64545;
  --radius: 13px;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

button:hover {
  background: var(--primary-dark);
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

#app {
  min-height: 100vh;
}

.loading {
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #12365f, #2875b9);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  padding: 32px;
  border-radius: 18px;
  box-shadow: 0 15px 45px #0002;
}

.logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  border-radius: 16px;
  background: #e9f2ff;
  color: var(--primary);
  font-size: 28px;
  font-weight: 800;
}

.auth-card h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 8px;
}

.auth-card > p {
  text-align: center;
  color: var(--muted);
  margin-bottom: 25px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 600;
}

.auth-card button {
  width: 100%;
  margin-top: 8px;
}

.auth-switch {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch button {
  width: auto;
  padding: 0;
  background: transparent;
  color: var(--primary);
}

.app-header {
  background: var(--primary-dark);
  color: white;
  padding: 17px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.app-header h1 {
  font-size: 21px;
}

.app-header p {
  font-size: 12px;
  opacity: .8;
  margin-top: 4px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user button {
  background: #ffffff20;
  border: 1px solid #ffffff50;
}

.app-layout {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.sidebar {
  background: white;
  border-right: 1px solid var(--border);
  padding: 20px 13px;
}

.sidebar-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 10px;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  color: #475467;
  text-align: left;
  margin-bottom: 5px;
  font-weight: 500;
}

.nav-button:hover,
.nav-button.active {
  background: #eaf2fc;
  color: var(--primary);
}

.main-content {
  padding: 28px;
  min-width: 0;
}

.page-heading {
  margin-bottom: 22px;
}

.page-heading h2 {
  font-size: 25px;
  margin-bottom: 7px;
}

.page-heading p {
  color: var(--muted);
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
  margin-top: 10px;
  color: var(--primary);
}

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.panel h3 {
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 17px;
}

.toolbar input {
  max-width: 300px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}

th {
  background: #f7f9fc;
  color: #475467;
}

td button {
  padding: 7px 10px;
  font-size: 12px;
  margin: 2px;
}

.btn-danger {
  background: var(--danger);
}

.btn-secondary {
  background: #e9eef5;
  color: #344054;
}

.btn-success {
  background: var(--success);
}

.message {
  padding: 12px 14px;
  border-radius: 9px;
  margin-bottom: 15px;
  font-size: 14px;
  background: #eaf2fc;
  color: var(--primary);
}

.message.error {
  background: #fff0f0;
  color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .main-content {
    padding: 20px;
  }
}

@media (max-width: 650px) {
  .app-header {
    padding: 14px;
  }

  .app-header h1 {
    font-size: 18px;
  }

  .app-layout {
    display: block;
  }

  .sidebar {
    display: flex;
    overflow-x: auto;
    gap: 5px;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-title {
    display: none;
  }

  .nav-button {
    width: auto;
    white-space: nowrap;
    margin: 0;
  }

  .main-content {
    padding: 15px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 23px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .auth-card {
    padding: 24px;
  }

  .header-user {
    gap: 5px;
  }
}
