:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --text: #102033;
  --muted: #637083;
  --primary: #1557c0;
  --primary-2: #0b3f93;
  --line: #dbe5f3;
  --danger: #c03636;
  --success: #168251;
  --warning: #b97400;
  --shadow: 0 18px 40px rgba(19, 52, 92, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 292px;
  background: linear-gradient(180deg, #0f3e8b, #0a2b62);
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: #fff; color: var(--primary); font-weight: 900; font-size: 24px;
  box-shadow: 0 14px 28px rgba(0,0,0,.16);
}
.brand strong { display: block; font-size: 17px; }
.brand span { display: block; color: rgba(255,255,255,.75); font-size: 12px; margin-top: 3px; }
.nav { display: grid; gap: 8px; overflow-y: auto; padding-right: 4px; }
.nav button {
  text-align: left; border: 0; border-radius: 12px; padding: 11px 12px;
  color: rgba(255,255,255,.84); background: transparent; cursor: pointer;
}
.nav button:hover, .nav button.active { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-footer { margin-top: auto; padding-top: 18px; display: grid; gap: 8px; color: rgba(255,255,255,.72); }
.pill { display: inline-flex; align-items: center; gap: 7px; width: max-content; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.13); }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #ffc857; }
.pill.ok::before { background: #35dc82; }
.pill.bad::before { background: #ff5b5b; }

.main { margin-left: 292px; width: calc(100% - 292px); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  min-height: 88px; display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 18px 28px; background: rgba(244,247,251,.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 25px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.menu-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 12px; }
.top-actions { display: flex; gap: 10px; }
.primary, .ghost {
  border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 700;
}
.primary { border: 0; background: var(--primary); color: #fff; }
.ghost { border: 1px solid var(--line); background: #fff; color: var(--text); }
.content { padding: 26px 28px 40px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px;
}
.card h2, .card h3 { margin: 0 0 10px; }
.card p { color: var(--muted); line-height: 1.45; }
.metric { display: grid; gap: 6px; }
.metric small { color: var(--muted); font-weight: 700; }
.metric strong { font-size: 30px; }
.metric span { color: var(--muted); font-size: 13px; }
.section-title { margin: 28px 0 14px; display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title p { margin: 4px 0 0; color: var(--muted); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: var(--panel-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #e9f2ff; color: var(--primary); }
.badge.success { background: #e7f7ef; color: var(--success); }
.badge.warning { background: #fff5df; color: var(--warning); }
.badge.danger { background: #ffecec; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.input {
  display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700;
}
.input input, .input select, .input textarea {
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; color: var(--text);
}
.input textarea { min-height: 94px; resize: vertical; }
.timeline { display: grid; gap: 12px; }
.event { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.event-icon { width: 34px; height: 34px; border-radius: 12px; background: #e9f2ff; color: var(--primary); display: grid; place-items: center; font-weight: 900; flex: 0 0 auto; }
.event strong { display: block; }
.event span { color: var(--muted); font-size: 13px; }
.module-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.module-item { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; display: flex; gap: 12px; align-items: start; }
.module-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #e9f2ff; color: var(--primary); font-weight: 900; flex: 0 0 auto; }
.notice { padding: 14px 16px; border-radius: 16px; border: 1px solid #ffe0a8; background: #fff8e9; color: #72500a; }

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
  .menu-btn { display: inline-flex; }
  .topbar { align-items: start; }
  .top-actions { display: none; }
  .content { padding: 18px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2, .module-list, .form-grid { grid-template-columns: 1fr; }
}
