:root {
  --brand-900: #0a2f2a;
  --brand-800: #0f3d36;
  --brand-700: #145247;
  --brand-600: #1a6b5c;
  --brand-500: #1f8a73;
  --brand-100: #e3f2ee;
  --accent: #c8a45c;
  --sidebar-w: 260px;
  --bs-primary: #1a6b5c;
  --bs-primary-rgb: 26, 107, 92;
  --bs-link-color: #1a6b5c;
  --bs-link-color-rgb: 26, 107, 92;
  --bs-link-hover-color: #0f3d36;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: #f4f6f5;
  --bs-border-radius: .6rem;
}

body { font-size: .925rem; color: #1d2a27; }

/* Bootstrap primary overrides */
.btn-primary { --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600); --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700); --bs-btn-active-bg: var(--brand-800); --bs-btn-active-border-color: var(--brand-800); --bs-btn-disabled-bg: var(--brand-600); --bs-btn-disabled-border-color: var(--brand-600); }
.btn-outline-primary { --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-600); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700); }
.text-bg-primary { background-color: var(--brand-600) !important; }
.text-primary { color: var(--brand-600) !important; }
.bg-primary-subtle { background-color: var(--brand-100) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .2rem rgba(31, 138, 115, .18); }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.page-link { color: var(--brand-600); }
.active > .page-link, .page-link.active { background-color: var(--brand-600); border-color: var(--brand-600); }
.nav-pills .nav-link.active { background: var(--brand-600); }
.progress-bar { background-color: var(--brand-500); }

/* ---------- Layout ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-800) 100%);
  color: #cfe3dd;
  width: var(--sidebar-w);
}
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1030; }
  .main { margin-left: var(--sidebar-w); }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--brand-900); }
  .sidebar { display: flex; flex-direction: column; }
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(200, 164, 92, .18); color: var(--accent); font-size: 1.15rem; }
.brand-name { color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .2px; }
.sidebar-nav { padding: .75rem .75rem 1rem; overflow-y: auto; flex: 1; }
.nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: rgba(207, 227, 221, .55); padding: 1rem .75rem .35rem; font-weight: 600; }
.sidebar .nav-link { display: flex; align-items: center; gap: .7rem; color: #cfe3dd; padding: .55rem .75rem; border-radius: .5rem; margin-bottom: 2px; font-weight: 500; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-link.active { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { padding: .9rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); color: rgba(207, 227, 221, .6); }

.main { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid #e3e8e6; }
.topbar-search { position: relative; align-items: center; width: min(420px, 45vw); }
.topbar-search i { position: absolute; left: .8rem; color: #8a9a95; }
.topbar-search .form-control { padding-left: 2.2rem; background: #f4f6f5; border-color: transparent; }
.btn-icon { font-size: 1.4rem; line-height: 1; padding: .25rem .5rem; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; background: transparent; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-100); color: var(--brand-700); font-weight: 700; }

.content { padding: 1.25rem; flex: 1; }
@media (min-width: 768px) { .content { padding: 1.75rem 2rem; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--brand-900); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: 1rem 2rem; border-top: 1px solid #e3e8e6; background: #fff; }

/* ---------- Components ---------- */
.card { border: 1px solid #e3e8e6; box-shadow: 0 1px 2px rgba(10, 47, 42, .04); }
.card-header { background: #fff; font-weight: 600; border-bottom-color: #eef1f0; }
.stat-card { padding: 1.1rem 1.2rem; }
.stat-card .stat-label { color: #6b7d78; font-size: .8rem; font-weight: 500; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--brand-900); line-height: 1.2; }
.stat-card .stat-sub { font-size: .78rem; color: #6b7d78; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--brand-100); color: var(--brand-600); }

.table > :not(caption) > * > * { padding: .65rem .75rem; vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7d78; font-weight: 600; background: #f8faf9; white-space: nowrap; }
.table-hover tbody tr:hover { background: #f8faf9; }
.badge-status { font-weight: 500; font-size: .72rem; }
.filters .form-control, .filters .form-select { min-width: 0; }
.text-truncate-200 { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.empty-state { text-align: center; padding: 3rem 1rem; color: #6b7d78; }
.empty-state i { font-size: 2.5rem; color: #b5c4bf; }
.bulk-bar { display: none; }
.bulk-bar.show { display: flex; }
.preview-frame { width: 100%; min-height: 520px; border: 1px solid #e3e8e6; border-radius: .5rem; background: #fff; }
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.merge-tag { cursor: pointer; }
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; border-left: 2px solid #e3e8e6; margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .25rem; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--brand-500); }
.bar-row { display: flex; align-items: center; gap: .5rem; }
.bar-row .bar { height: 8px; border-radius: 4px; background: var(--brand-500); }

/* Mobile: stacked "card" tables */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border: 1px solid #e3e8e6; border-radius: .6rem; margin-bottom: .75rem; background: #fff; padding: .35rem 0; }
  .table-stack td { border: 0 !important; padding: .3rem .9rem !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: #6b7d78; font-size: .78rem; text-align: left; flex-shrink: 0; }
  .table-stack td.td-actions { justify-content: flex-end; }
  .table-stack td.td-actions::before { content: none; }
  .table-stack td.td-check::before { content: "Select"; }
  .page-actions .btn { flex: 1 1 auto; }
}

/* ---------- Login ---------- */
.login-body { min-height: 100vh; background: #f4f6f5; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 991.98px) { .login-wrap { grid-template-columns: 1fr; } }
.login-hero {
  position: relative; overflow: hidden; color: #e8f3ef; padding: 3rem 3.5rem; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 500px at -10% 110%, rgba(31, 138, 115, .35), transparent 60%),
    radial-gradient(700px 400px at 110% -10%, rgba(200, 164, 92, .18), transparent 60%),
    linear-gradient(160deg, #0a2f2a 0%, #0f3d36 55%, #0a2f2a 100%);
}
.login-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.login-hero > * { position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: 1.2rem; color: #fff; }
.login-hero h1 { font-size: clamp(2rem, 3.6vw, 3.1rem); font-weight: 700; line-height: 1.12; color: #fff; margin: 2.5rem 0 1rem; max-width: 14ch; }
.login-hero h1 em { font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 500; color: var(--accent); }
.login-hero p.lead { color: #bcd6ce; max-width: 42ch; font-size: 1.05rem; }
.feature-list { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .85rem; }
.feature-list li { display: flex; align-items: center; gap: .75rem; color: #dcebe6; }
.feature-list i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: var(--accent); }
.login-hero .hero-foot { color: rgba(220, 235, 230, .6); font-size: .82rem; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.login-card { width: 100%; max-width: 420px; }
.login-card .eyebrow { font-size: .72rem; letter-spacing: .14em; font-weight: 700; color: var(--brand-600); text-transform: uppercase; display: flex; align-items: center; gap: .4rem; }
.login-card h2 { font-weight: 700; color: var(--brand-900); margin: .4rem 0 .35rem; }
.login-card .form-control { padding: .75rem .9rem; }
.login-card .input-group-text { background: #fff; }
.login-card .btn-login { padding: .75rem; font-weight: 600; }
.login-foot { color: #6b7d78; font-size: .8rem; text-align: center; margin-top: 2rem; }
@media (max-width: 991.98px) {
  .login-hero { padding: 1.75rem 1.5rem 2rem; }
  .login-hero h1 { margin-top: 1.25rem; font-size: 1.9rem; }
  .login-hero .feature-list, .login-hero .hero-foot { display: none; }
  .login-panel { align-items: flex-start; padding-top: 2rem; }
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .page-link:hover { text-decoration: none; }
