:root {
  --primary: #3065B2;
  --text-primary: #214B82;
  --secondary: #7BD3E0;
  --accent: #C5A536;
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --muted: #5C6F8F;
  --border: #D8E2F0;
  --success: #2E9E6E;
  --warning: #DAA300;
  --danger: #C0392B;
  --shadow: 0 8px 30px rgba(33, 75, 130, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
}

h1, h2, h3, h4 {
  margin: 0;
}

p {
  margin: 0 0 8px 0;
}

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-center h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 4px 0;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  padding: 20px 24px 40px;
}

.nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  border: none;
  background: transparent;
  padding: 12px;
  text-align: left;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(48, 101, 178, 0.07);
}

.nav-item.active {
  background: rgba(48, 101, 178, 0.12);
  border: 1px solid var(--primary);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.context-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #EEF3FB;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.section {
  margin-bottom: 20px;
}

.section h3 {
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th, .table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.primary-button, .secondary-button, .ghost-button {
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}

.primary-button {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

.secondary-button {
  background: rgba(123, 211, 224, 0.18);
  color: var(--text-primary);
  border: 1px solid var(--secondary);
}

.ghost-button {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.ghost-button.danger {
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.4);
}

.full {
  width: 100%;
}

.input-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

input, select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #FBFDFF;
}

label {
  font-size: 13px;
  color: var(--muted);
}

.banner {
  margin: 0 24px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--warning);
  background: #FFF8E6;
  color: #7a5a00;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FAFCFF;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-active { background: var(--success); }
.status-pending { background: var(--warning); }
.status-danger { background: var(--danger); }

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(123, 211, 224, 0.2);
  border: 1px solid var(--secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
}

.login {
  position: fixed;
  inset: 0;
  background: rgba(33, 75, 130, 0.06);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 90vw);
  padding: 24px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

.error-text {
  color: var(--danger);
  min-height: 18px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--text-primary);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: fade-in 0.2s forwards, fade-out 0.2s 3s forwards;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-out {
  to { opacity: 0; transform: translateY(6px); }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-item {
    flex: 1 1 45%;
    text-align: center;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-center {
    position: static;
    transform: none;
    width: 100%;
    justify-content: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* List Item Styles */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
}

.list-item:hover {
  background-color: var(--bg);
}

.list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-title {
  font-weight: 600;
  color: var(--text-primary);
}

.list-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.list-role {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--secondary);
  color: white;
  display: inline-block;
  width: fit-content;
}

.list-actions {
  display: flex;
  gap: 8px;
}

.list-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Styles */
.input-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.input-row label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Status Badges */
.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-active {
  background: var(--success);
  color: white;
}

.status-pending {
  background: var(--warning);
  color: white;
}

.status-warning {
  background: var(--warning);
  color: white;
}

.status-success {
  background: var(--success);
  color: white;
}

.status-danger {
  background: var(--danger);
  color: white;
}

.admin-page {
  display: grid;
  gap: 22px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}

.page-header h2 {
  font-size: 28px;
  color: var(--text-primary);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.metric-card,
.admin-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FAFCFF;
}

.metric-card {
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}

.metric-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.admin-panel {
  padding: 18px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.detail-item {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.detail-item:first-child,
.detail-item:nth-child(2) {
  border-top: none;
}

.detail-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.detail-value {
  font-weight: 700;
  color: var(--text-primary);
}

.warning-list {
  display: grid;
  gap: 10px;
}

.warning-item {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FAFCFF;
}

.warning-item.warning {
  border-color: rgba(218, 163, 0, 0.45);
  background: #FFF8E6;
}

.warning-item.danger {
  border-color: rgba(192, 57, 43, 0.35);
  background: #FCEEEE;
}

.warning-item.success {
  border-color: rgba(46, 158, 110, 0.35);
  background: #EAF7F1;
}

.limit-row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.limit-row:last-child {
  border-bottom: none;
}

.limit-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #E6EEF8;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  width: 0%;
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--danger);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.feature-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FAFCFF;
}

.data-table-wrapper {
  overflow-x: auto;
}

.action-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented-control {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented-control button {
  border: 1px solid var(--border);
  background: #FAFCFF;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control button.active {
  border-color: var(--primary);
  background: rgba(48, 101, 178, 0.12);
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

/* Section Styles */
.section-header {
  margin-bottom: 24px;
}

.section-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-header .muted {
  font-size: 16px;
  color: var(--muted);
}

/* Enhanced Responsive */
@media (max-width: 768px) {
  .input-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .list-actions {
    align-self: stretch;
    justify-content: flex-end;
  }
}
