:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #19313a;
  background: #f5f7f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }

.loading-shell, .login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  padding: 2rem;
  background: radial-gradient(circle at top left, #e4eff0, transparent 45%), #f7f9f9;
}

.spinner { width: 2rem; height: 2rem; border: 3px solid #cddbdd; border-top-color: #176b7a; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-card { width: min(100%, 430px); padding: 2.5rem; background: white; border: 1px solid #dce5e6; border-radius: 18px; box-shadow: 0 18px 45px rgba(24, 60, 74, .12); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; color: white; background: #176b7a; font-weight: 800; letter-spacing: .03em; }
h1, h2, h3, p { margin-top: 0; }
.login-card h1 { margin: 1.25rem 0 .5rem; font-size: 1.8rem; }
.muted { color: #61747b; }
.primary, .secondary, .danger { border: 0; border-radius: 9px; padding: .72rem 1rem; font-weight: 700; }
.primary { color: white; background: #176b7a; }
.primary:hover { background: #105967; }
.secondary { color: #21414b; background: #e8eff0; }
.danger { color: #8a2530; background: #fbeaec; }
.full { width: 100%; margin-top: 1.25rem; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 4vw, 3rem); background: #183c4a; color: white; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 800; }
.brand .brand-mark { width: 36px; height: 36px; background: #2b8795; font-size: .8rem; }
.user-actions { display: flex; align-items: center; gap: .8rem; }
.user-actions button { color: white; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: .5rem .75rem; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 68px); }
.sidebar { padding: 1.5rem 1rem; background: white; border-right: 1px solid #dce5e6; }
.nav-button { width: 100%; display: flex; gap: .7rem; align-items: center; margin-bottom: .35rem; padding: .72rem .8rem; color: #40565e; background: transparent; border: 0; border-radius: 8px; text-align: left; }
.nav-button.active, .nav-button:hover { color: #125c69; background: #e8f2f3; }
.content { padding: clamp(1.25rem, 4vw, 3rem); overflow: hidden; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading h1 { margin-bottom: .35rem; font-size: clamp(1.7rem, 4vw, 2.25rem); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card, .panel { background: white; border: 1px solid #dce5e6; border-radius: 12px; box-shadow: 0 4px 15px rgba(24, 60, 74, .04); }
.card { padding: 1.25rem; }
.card strong { display: block; margin-top: .4rem; font-size: 2rem; color: #153d49; }
.panel { overflow: hidden; }
.panel-header { padding: 1rem 1.2rem; border-bottom: 1px solid #e4eaeb; }
.panel-header h2 { margin: 0; font-size: 1.05rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem 1.1rem; text-align: left; border-bottom: 1px solid #edf1f1; white-space: nowrap; }
th { color: #65777d; background: #fafbfb; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.pill { display: inline-flex; padding: .25rem .55rem; border-radius: 999px; background: #e8f2f3; color: #125c69; font-size: .78rem; font-weight: 700; }
.empty { padding: 2.5rem 1.2rem; color: #6c7d82; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(8, 27, 34, .58); z-index: 10; }
.modal { width: min(100%, 520px); padding: 1.5rem; background: white; border-radius: 14px; box-shadow: 0 22px 65px rgba(0,0,0,.2); }
.field { display: grid; gap: .4rem; margin: 1rem 0; }
.field label { font-weight: 700; font-size: .9rem; }
.field input { width: 100%; padding: .72rem; border: 1px solid #bdcbcf; border-radius: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }
.notice, .error { margin-bottom: 1rem; padding: .85rem 1rem; border-radius: 9px; }
.notice { color: #4b5e21; background: #f0f5dc; }
.error { color: #8a2530; background: #fbeaec; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid #dce5e6; padding: .6rem; }
  .nav-button { width: auto; min-width: max-content; margin: 0 .25rem 0 0; }
  .cards { grid-template-columns: 1fr; }
  .user-name { display: none; }
}
