@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #F5F0E4; color: #1F2A24; font-family: 'IBM Plex Sans', sans-serif;
}
a { color: #1F3D2B; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: #FBF8F1; border: 1px solid #E3DAC2; border-radius: 12px;
  padding: 32px 28px; box-shadow: 0 2px 0 rgba(31,61,43,0.05);
}
.login-mark {
  width: 44px; height: 44px; border-radius: 8px; background: #C99A3B; color: #1F3D2B;
  display: flex; align-items: center; justify-content: center; font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 18px; margin-bottom: 14px;
}
.login-card h1 { font-family: 'Zilla Slab', serif; font-size: 21px; margin: 0 0 4px; color: #1F3D2B; }
.login-card p.sub { font-size: 13px; color: #7A7460; margin: 0 0 22px; }
.login-card label { display: block; font-size: 12.5px; color: #5F5A4A; margin-bottom: 5px; margin-top: 14px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: #1F3D2B; color: #EFE8D4; display: flex; flex-direction: column;
  flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(239,232,212,0.14); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 6px; background: #C99A3B; color: #1F3D2B;
  display: flex; align-items: center; justify-content: center; font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.brand-title { font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 10.5px; color: #B9C4B6; margin-top: 2px; }

.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: #8FA091; padding: 14px 16px 4px; }
.nav-list { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 6px;
  color: #D6D0BC; font-size: 13.3px; text-decoration: none;
}
.nav-item:hover { background: rgba(239,232,212,0.08); color: #F5F0E4; }
.nav-item.active { background: #2E5940; color: #F5F0E4; font-weight: 500; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; font-size: 11px; color: #8FA091; border-top: 1px solid rgba(239,232,212,0.1); }
.sidebar-foot a { color: #D6D0BC; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: #FBF8F1;
  border-bottom: 1px solid #E3DAC2; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 19px; flex: 1; }
.who { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #5F5A4A; }
.who strong { color: #1F3D2B; }
.who a { color: #A32D2D; text-decoration: none; font-weight: 500; }

.content { padding: 22px 24px 48px; max-width: 1100px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-card { background: #FBF8F1; border: 1px solid #E3DAC2; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 12px; color: #7A7460; }
.stat-value { font-family: 'IBM Plex Mono', monospace; font-size: 24px; font-weight: 500; color: #1F3D2B; }
.stat-green { color: #3B6D11; }
.stat-red { color: #A32D2D; }

.card { background: #FBF8F1; border: 1px solid #E3DAC2; border-radius: 10px; padding: 18px 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 17px; margin: 0; color: #1F3D2B; }
.card-sub { font-size: 12.5px; color: #7A7460; margin: 3px 0 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #5F5A4A; }
.col-2 { grid-column: 1 / -1; }

input, select, textarea, button {
  font-family: 'IBM Plex Sans', sans-serif; font-size: 13.5px;
}
input, select, textarea {
  padding: 8px 10px; border: 1px solid #D8CFB8; border-radius: 6px; background: #fff; color: #1F2A24; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #C99A3B; outline-offset: 0; border-color: #C99A3B; }

.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.row-actions > * { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px;
  border: 1px solid #D8CFB8; background: #fff; color: #1F2A24; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #1F3D2B; border-color: #1F3D2B; color: #F5F0E4; }
.btn-primary:hover:not(:disabled) { background: #2E5940; }
.btn-danger { color: #A32D2D; border-color: #E3B7B5; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.icon-btn { background: none; border: none; cursor: pointer; color: #A32D2D; padding: 4px; }

.hint { font-size: 13px; color: #5F5A4A; margin: 4px 0 0; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: #7A7460; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid #E3DAC2; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #EEE7D2; vertical-align: top; }
.empty-row { text-align: center; color: #9A9480; padding: 20px 10px; font-style: italic; }
.tbl-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-green { background: #EAF3DE; color: #27500A; }
.badge-red { background: #FCEBEB; color: #791F1F; }
.badge-amber { background: #FAEEDA; color: #633806; }
.badge-role { background: #E6F1FB; color: #0C447C; }

.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-success { background: #EAF3DE; color: #27500A; border: 1px solid #C0DD97; }
.alert-error { background: #FCEBEB; color: #791F1F; border: 1px solid #F0999; }

.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.export-item { background: #FBF8F1; border: 1px solid #E3DAC2; border-radius: 8px; padding: 14px 16px; }
.export-item h3 { font-family: 'Zilla Slab', serif; font-size: 14.5px; margin: 0 0 4px; color: #1F3D2B; }
.export-item p { font-size: 12px; color: #7A7460; margin: 0 0 10px; }
.export-item .btn-row { display: flex; gap: 8px; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: static; height: auto; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
