:root {
  --navy: #0f3d4c;
  --navy-2: #14586a;
  --teal: #1a9b8e;
  --teal-d: #147c72;
  --bg: #f3f6f8;
  --card: #fff;
  --text: #1c2b33;
  --muted: #5b6d75;
  --line: #d9e3e8;
  --green: #1b8a5a;
  --green-bg: #e5f7ee;
  --yellow: #b8860b;
  --yellow-bg: #fff6d9;
  --orange: #d46b08;
  --orange-bg: #fff1e3;
  --red: #c0392b;
  --red-bg: #fdecea;
  --gray: #607080;
  --gray-bg: #eef1f4;
  --shadow: 0 8px 24px rgba(15, 61, 76, .08);
  --sidebar: 260px;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--navy-2); text-decoration: none; }
img { max-width: 100%; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--navy) 0%, #0b2d38 100%);
  color: #e8f4f6;
  position: sticky; top: 0; height: 100vh; overflow: auto;
  flex-shrink: 0;
}
.brand { padding: 22px 20px 12px; }
.brand h1 { font-size: 15px; margin: 0 0 4px; letter-spacing: .4px; }
.brand p { margin: 0; font-size: 12px; opacity: .7; }
.nav { padding: 8px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #d7eaee; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 2px;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .5; padding: 14px 12px 6px; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; position: sticky; top: 0; z-index: 10;
}
.topbar .who { font-size: 13px; color: var(--muted); text-align: right; }
.topbar strong { color: var(--text); }
.content { padding: 22px; }

.cards { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 700; margin: 6px 0 0; }
.stat.green { border-top: 3px solid var(--green); }
.stat.yellow { border-top: 3px solid var(--yellow); }
.stat.orange { border-top: 3px solid var(--orange); }
.stat.red { border-top: 3px solid var(--red); }
.stat.teal { border-top: 3px solid var(--teal); }
.stat.navy { border-top: 3px solid var(--navy); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fbfc; }
tr:hover td { background: #f7fbfc; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: var(--gray-bg); color: var(--gray); }
.badge.teal { background: #e6f7f5; color: var(--teal-d); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal); color: #fff; border: 0; border-radius: 10px;
  padding: 9px 14px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.btn:hover { background: var(--teal-d); }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; color: var(--navy-2); }
.btn.small { padding: 6px 10px; font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 80px; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field { margin-bottom: 12px; }
.row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.alert.success { background: var(--green-bg); color: #146c45; }
.alert.error { background: var(--red-bg); color: #8e2118; }
.alert.warning { background: var(--yellow-bg); color: #7a5b08; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 22px; }
.muted { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at 20% 20%, #1a9b8e 0, transparent 35%), linear-gradient(135deg, #0f3d4c, #14586a);
}
.auth-card { width: min(440px, 92vw); background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }

.modal {
  display: none; position: fixed; inset: 0; background: rgba(12, 28, 34, .45);
  z-index: 50; place-items: center; padding: 20px;
}
.modal.open { display: grid; }
.modal .box { background: #fff; border-radius: 16px; padding: 20px; width: min(560px, 100%); }

.chart-box { height: 260px; }
h3 { margin: 0 0 12px; font-size: 16px; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .row-3, .row-4 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -280px; z-index: 30; transition: left .2s; }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-block; }
  .row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
