:root {
  --tb-bg: #f4f7fb;
  --tb-sidebar: #0f2744;
  --tb-sidebar-2: #16365c;
  --tb-accent: #1f9d8a;
  --tb-accent-2: #f0a202;
  --tb-text: #1c2b3a;
  --tb-muted: #6b7c8f;
  --tb-card: #ffffff;
  --tb-border: #e3ebf3;
  --tb-radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--tb-text);
  background: var(--tb-bg);
}

a { color: var(--tb-accent); text-decoration: none; }
a:hover { color: #177d6e; }

.tb-shell { display: flex; min-height: 100vh; }
.tb-sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--tb-sidebar), var(--tb-sidebar-2));
  color: #fff;
  flex-shrink: 0;
  padding: 1.25rem 1rem;
}
.tb-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  padding: 0 .5rem;
}
.tb-brand span { color: var(--tb-accent-2); }
.tb-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: rgba(255,255,255,.82);
  padding: .65rem .75rem;
  border-radius: 10px;
  margin-bottom: .25rem;
}
.tb-nav a:hover, .tb-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.tb-nav .nav-section {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.45);
  margin: 1rem .75rem .4rem;
}
.tb-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tb-topbar {
  background: var(--tb-card);
  border-bottom: 1px solid var(--tb-border);
  padding: .9rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.tb-content { padding: 1.25rem; }
.tb-card {
  background: var(--tb-card);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 8px 24px rgba(15, 39, 68, .04);
}
.tb-stat {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.tb-stat .label { color: var(--tb-muted); font-size: .85rem; }
.tb-stat .value { font-size: 1.6rem; font-weight: 700; }
.tb-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: .78rem;
  font-weight: 600;
}
.tb-badge-ok { background: #e6f7f3; color: #0f7668; }
.tb-badge-warn { background: #fff4df; color: #9a6700; }
.tb-badge-off { background: #eef2f6; color: #64748b; }
.tb-msg {
  border-radius: 12px;
  padding: .75rem 1rem;
  margin-bottom: .65rem;
  max-width: 860px;
  white-space: pre-wrap;
}
.tb-msg-in { background: #eef5ff; border: 1px solid #d6e6ff; }
.tb-msg-out { background: #e8f8f4; border: 1px solid #c9eee5; }
.tb-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(31,157,138,.18), transparent 40%),
    radial-gradient(circle at bottom right, rgba(240,162,2,.18), transparent 35%),
    var(--tb-bg);
}
.tb-login-card { width: min(420px, 94vw); }
.sidebar-toggle { display: none; }
.tb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 40;
}
.tb-table td, .tb-table th { vertical-align: middle; }
.form-hint { color: var(--tb-muted); font-size: .85rem; }

@media (max-width: 992px) {
  .sidebar-toggle { display: inline-flex; }
  .tb-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .tb-shell.sidebar-open .tb-sidebar { transform: translateX(0); }
  .tb-shell.sidebar-open .tb-backdrop { display: block; }
}
