:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-raised: #fbfcfd;
  --surface-soft: #f7fafb;
  --text: #15202b;
  --heading: #0d1b2a;
  --muted: #647180;
  --primary: #1f4f7a;
  --primary-strong: #183d5f;
  --primary-soft: #e8f1f7;
  --accent: #14746f;
  --accent-strong: #0f5c58;
  --accent-soft: #e7f4f2;
  --warm: #a16207;
  --warm-soft: #fff7df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --ok: #14713d;
  --ok-soft: #e9f7ee;
  --border: #d7e0e7;
  --border-strong: #b8c7d2;
  --shadow: 0 14px 38px rgba(13, 27, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(13, 27, 42, 0.05);
  --shadow-focus: 0 0 0 4px rgba(31, 79, 122, 0.18);
  --radius: 8px;
  --radius-sm: 6px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --font-ui: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(232, 241, 247, 0.75) 0, rgba(243, 246, 248, 0) 320px),
    var(--bg);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
}

.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  background: #102234;
  color: #ecf4f8;
  padding: 18px 14px;
  border-right: 1px solid rgba(255,255,255,0.08);
  scrollbar-gutter: stable;
}
.brand {
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}
.brand::before {
  content: "TH";
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 9px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  vertical-align: middle;
}
.brand-subtitle {
  margin: 9px 0 20px 43px;
  color: #a9bdca;
  font-size: 12px;
  line-height: 1.4;
}
.nav {
  display: grid;
  gap: 5px;
}
.nav button {
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
  padding-inline: 11px;
  color: #c8d7e1;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.nav button:hover { background: rgba(255,255,255,0.08); }
.nav button.active {
  background: #f5fbff;
  color: #102234;
  box-shadow: inset 3px 0 0 var(--accent);
}

.main {
  width: min(100%, 1480px);
  padding: 18px clamp(14px, 2vw, 24px) 28px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(215, 224, 231, 0.8);
}
.top strong {
  display: inline-block;
  color: var(--heading);
  font-size: 22px;
  letter-spacing: 0;
}
.hamburger { display: none; }

.page {
  display: grid;
  gap: 14px;
  animation: page-in .14s ease both;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.page-header h1 {
  margin: 0;
  color: var(--heading);
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: 0;
}
.page-header p {
  max-width: 72ch;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.page-body {
  display: grid;
  gap: 14px;
}

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

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 30;
    transition: left .2s;
    box-shadow: 22px 0 60px rgba(13, 27, 42, 0.2);
  }
  .sidebar.open { left: 0; }
  .hamburger { display: inline-flex; }
  .main {
    width: 100%;
    padding: 12px;
  }
}

@media (max-width: 720px) {
  .top {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
    gap: 10px;
  }
  .top > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .top strong { font-size: 20px; }
  .top .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .top .actions button { width: 100%; }
  .page-header {
    display: grid;
    gap: 10px;
  }
  .page-header h1 { font-size: 22px; }
  .page-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .page-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
