:root {
  --navy: #14263f;
  --navy-2: #1e3a5f;
  --accent: #f0a500;
  --sidebar-w: 236px;
}
body { background: var(--bs-tertiary-bg); font-size: .925rem; }
[data-bs-theme="dark"] body { background: #10151c; }
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--navy); color: #c9d4e3; padding: 18px 14px; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1040; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; margin-bottom: 18px; padding: 0 6px; }
.sidebar .brand i { font-size: 1.5rem; color: var(--accent); }
.sidebar .brand img { height: 32px; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: #c9d4e3; text-decoration: none; padding: 8px 10px; border-radius: 6px; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-foot { margin-top: auto; font-size: .75rem; opacity: .5; padding: 10px 6px 0; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 1030; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); padding: 10px 24px; display: flex; align-items: center; }
.topbar .search { position: relative; width: 380px; }
.topbar .search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); }
.topbar .search input { padding-left: 32px; }
.avatar { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 13px; background: var(--navy-2); color: #fff; font-size: .7rem; font-weight: 700; }
.content { padding: 24px; max-width: 1500px; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  .content { padding: 16px; }
}

/* Page heading */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--bs-secondary-color); font-size: .9rem; }

/* Cards */
.card { border: 1px solid var(--bs-border-color-translucent); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; font-weight: 600; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; }
.stat .num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--bs-secondary-color); font-size: .82rem; }
a.stat-link { text-decoration: none; color: inherit; }
a.stat-link:hover .card { border-color: var(--navy-2); }

/* Tables */
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); font-weight: 600; white-space: nowrap; }
.table td { vertical-align: middle; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bs-danger); }
.desc-cell { min-width: 280px; }

/* Minutes builder */
.topic-block { border: 1px solid var(--bs-border-color); border-radius: 8px; margin-bottom: 16px; background: var(--bs-body-bg); }
.topic-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bs-secondary-bg); border-bottom: 1px solid var(--bs-border-color); border-radius: 8px 8px 0 0; }
.topic-no { font-weight: 800; color: var(--navy-2); min-width: 28px; }
[data-bs-theme="dark"] .topic-no { color: var(--accent); }
.topic-head .title { font-weight: 700; }
.mrow { display: grid; grid-template-columns: 1fr 120px 110px 110px 90px; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--bs-border-color-translucent); align-items: start; }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: var(--bs-tertiary-bg); }
.mrow .meta { font-size: .78rem; color: var(--bs-secondary-color); }
.mrow-head { font-size: .72rem; text-transform: uppercase; color: var(--bs-secondary-color); font-weight: 600; padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 767.98px) { .mrow { grid-template-columns: 1fr 1fr; } .mrow > :first-child { grid-column: 1 / -1; } .mrow-head { display: none; } }

.new-pill { font-size: .65rem; background: var(--accent); color: #000; border-radius: 4px; padding: 1px 5px; font-weight: 700; vertical-align: middle; }

/* Timeline */
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: -6px; width: 2px; background: var(--bs-border-color); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 2px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy-2); border: 2px solid var(--bs-body-bg); }
.timeline .when { font-size: .78rem; color: var(--bs-secondary-color); }

.empty { text-align: center; padding: 40px 16px; color: var(--bs-secondary-color); }
.empty i { font-size: 2.4rem; display: block; margin-bottom: 8px; opacity: .6; }

/* Bare pages */
body.bare { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, #2b5283 100%); min-height: 100vh; }
.auth-card { max-width: 420px; margin: 8vh auto 0; }
.auth-card .card { border: 0; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

.ts-wrapper.form-select { padding: 0; }
.ts-control { min-height: 38px; }
.chip { display: inline-block; background: var(--bs-secondary-bg); border-radius: 12px; padding: 1px 8px; font-size: .78rem; font-weight: 600; margin: 1px; }
.small-muted { font-size: .8rem; color: var(--bs-secondary-color); }
.cursor-pointer { cursor: pointer; }

@media print {
  .sidebar, .topbar, .no-print, .btn { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}
.mrow.overdue-row { box-shadow: inset 3px 0 0 var(--bs-danger); }
.sidebar .brand img.app-icon { background: none; padding: 0; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
