:root {
  --ink: #0b4251;
  --ink-soft: #416b73;
  --cream: #fee6bb;
  --sand: #eec492;
  --sun: #f2c864;
  --coral: #f48676;
  --sage: #6d9496;
  --paper: #fffaf1;
  --white: #ffffff;
  --border: rgba(11, 66, 81, .13);
  --shadow: 0 18px 45px rgba(11, 66, 81, .12);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }

body {
  min-height: 100vh;
  padding-top: 66px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, h3, h4, .navbar-brand { font-weight: 800; letter-spacing: -.04em; }
a { color: var(--ink); }
.text-muted { color: var(--ink-soft) !important; }

.app-nav {
  position: fixed;
  z-index: 1040;
  top: 0;
  right: 0;
  left: 0;
  width: 100%;
  min-height: 66px;
  background: var(--ink);
  box-shadow: 0 4px 18px rgba(11, 66, 81, .16);
}
.app-nav > .container { width: 100%; max-width: none; padding-right: clamp(1rem, 3vw, 3rem); padding-left: clamp(1rem, 3vw, 3rem); }
.app-nav .navbar-brand { color: var(--cream); font-size: 1.35rem; }
.app-nav .navbar-brand span { color: var(--coral); }
.app-nav .navbar-brand-public { display: inline-flex; align-items: center; gap: .55rem; }
.app-nav .navbar-brand-public img { width: 2rem; height: 2rem; object-fit: contain; border-radius: .55rem; }
.app-nav .navbar-brand-public .brand-name { color: var(--cream); }
.app-nav .navbar-brand-public .brand-name span { color: var(--cream); }
.app-nav .navbar-brand-public .brand-name strong { color: var(--coral); }
.app-nav .nav-link { color: rgba(255, 250, 241, .82); font-weight: 600; }
.app-nav .nav-link:hover { color: var(--sun); }
.app-nav .navbar-toggler { border-color: rgba(254, 230, 187, .5); }
.app-nav .navbar-toggler-icon { filter: brightness(0) invert(1); }

.app-main { max-width: 1280px; }
.authenticated-main { width: calc(100% - 286px); max-width: none; min-width: 0; margin-right: 0; margin-left: 286px; transition: width .25s ease, margin-left .25s ease; }
.sidebar-trigger { display: inline-grid; width: 2.35rem; height: 2.35rem; margin-right: .8rem; place-items: center; padding: 0; border: 1px solid rgba(254, 230, 187, .45); border-radius: .65rem; color: var(--cream); background: transparent; font-size: 1.4rem; }
.sidebar-trigger:hover { color: var(--sun); border-color: var(--sun); }
.app-sidebar { position: fixed; z-index: 1030; top: 66px; bottom: 0; left: 0; display: flex; width: 286px; flex-direction: column; padding: 1.35rem 1rem 1rem; border-right: 1px solid rgba(11, 66, 81, .12); background: var(--cream); box-shadow: 10px 0 30px rgba(11, 66, 81, .08); transition: transform .25s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .8rem; padding: .35rem .65rem 1.2rem; border-bottom: 1px solid rgba(11, 66, 81, .12); }
.sidebar-brand-mark { display: grid; width: 2.55rem; height: 2.55rem; flex: 0 0 2.55rem; place-items: center; overflow: hidden; border-radius: .85rem; background: var(--ink); }
.sidebar-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand strong { display: block; color: var(--ink); font-size: 1rem; letter-spacing: -.04em; }
.sidebar-brand strong span { color: var(--coral); }
.sidebar-brand small { display: block; margin-top: .12rem; color: var(--ink-soft); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-context { display: flex; align-items: center; gap: .5rem; padding: 1rem .7rem .7rem; color: var(--ink-soft); font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-context-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 .25rem rgba(244, 134, 118, .2); }
.sidebar-nav { display: grid; gap: .28rem; }
.sidebar-link { display: flex; align-items: center; gap: .75rem; padding: .78rem .8rem; border-radius: .85rem; color: var(--ink-soft); font-weight: 750; text-decoration: none; transition: background .2s ease, color .2s ease, transform .2s ease; }
.sidebar-link:hover { color: var(--ink); background: rgba(255, 255, 255, .65); transform: translateX(2px); }
.sidebar-link.is-active { color: var(--paper); background: var(--ink); box-shadow: 0 8px 16px rgba(11, 66, 81, .18); }
.sidebar-link.is-active .sidebar-icon { color: var(--sun); }
.sidebar-icon { display: inline-grid; width: 1.45rem; place-items: center; color: var(--sage); font-size: 1.05rem; }
.sidebar-section { margin: 1.1rem .8rem .35rem; color: var(--coral); font-size: .66rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; }
.sidebar-user { display: flex; align-items: center; gap: .65rem; padding: .9rem .65rem .2rem; border-top: 1px solid rgba(11, 66, 81, .12); color: var(--ink); }
.sidebar-avatar { display: grid; width: 2.25rem; height: 2.25rem; flex: 0 0 2.25rem; place-items: center; border: 2px solid var(--paper); border-radius: .8rem; color: var(--ink); background: var(--sun); font-weight: 850; }
.sidebar-user-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.sidebar-user-copy strong { font-size: .82rem; }
.sidebar-user-copy small { color: var(--ink-soft); font-size: .7rem; }
.sidebar-user-status { color: var(--sage); font-size: .85rem; }
body.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .authenticated-main { width: 100%; margin-left: 0; }
.flash-stack { position: relative; z-index: 2; }
.alert { border: 0; border-radius: 1rem; box-shadow: 0 8px 24px rgba(11, 66, 81, .08); }
.alert-danger { color: #6f2923; background: #fbd0c8; }
.alert-success { color: var(--ink); background: #c5d9d4; }
.delete-confirm-icon { display: grid; width: 2.9rem; height: 2.9rem; place-items: center; border-radius: .9rem; color: #6f2923; background: #fbd0c8; font-size: 1.25rem; }

.btn { border-radius: .8rem; padding: .75rem 1.2rem; font-weight: 750; border-width: 2px; }
.btn-primary { color: var(--ink); background: var(--sun); border-color: var(--sun); }
.btn-primary:hover, .btn-primary:focus { color: var(--ink); background: var(--coral); border-color: var(--coral); }
.btn-secondary { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { color: var(--ink); background: var(--cream); border-color: var(--cream); }
.btn-outline-secondary { color: var(--ink); border-color: var(--ink); }
.btn-outline-secondary:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.btn-danger { color: var(--paper); background: var(--coral); border-color: var(--coral); }

.surface { background: var(--white); border: 1px solid var(--border); border-radius: 1.35rem; box-shadow: var(--shadow); }
.eyebrow { color: var(--coral); font-size: .76rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }

.hero {
  position: relative; overflow: hidden; min-height: 620px; display: flex; align-items: center;
  background: var(--ink); border-radius: 0 0 2rem 2rem; color: var(--paper); box-shadow: var(--shadow);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 42% 58% 56% 44%; opacity: .95; }
.hero::before { width: 330px; height: 260px; right: -80px; top: -70px; background: var(--coral); transform: rotate(18deg); }
.hero::after { width: 280px; height: 320px; left: -100px; bottom: -130px; background: var(--sage); transform: rotate(28deg); }
.hero-content { position: relative; z-index: 1; max-width: 780px; padding: 5rem 1rem; }
.hero h1 { max-width: 760px; font-size: clamp(3.1rem, 8vw, 6.7rem); line-height: .92; }
.hero h1 em { color: var(--sun); font-style: normal; }
.hero .lead { max-width: 600px; color: rgba(255, 250, 241, .8); font-size: 1.15rem; }
.hero-mark { position: absolute; right: 9%; bottom: 15%; z-index: 0; width: 150px; height: 150px; border: 2px solid var(--sun); border-radius: 50%; transform: rotate(-18deg); }
.hero-mark::after { content: "✦"; position: absolute; inset: 20px; display: grid; place-items: center; color: var(--sun); font-size: 5rem; }
.visual-section { margin-top: 5rem; }
.visual-story { position: relative; display: block; outline: 0; }
.visual-story-stage { position: relative; height: 610px; overflow: hidden; border-radius: 1.5rem; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); transition: background .35s ease, border-radius .35s ease; }
.visual-story-stage::before, .visual-story-stage::after { position: absolute; z-index: 1; content: ""; border-radius: 50%; transition: transform .45s ease, background .35s ease; }
.visual-story-stage::after { display: none; }
.visual-story-stage::before { width: 22vw; height: 22vw; min-width: 180px; min-height: 180px; right: -7vw; top: -8vw; background: var(--coral); }
.visual-story-stage::after { width: 18vw; height: 18vw; min-width: 150px; min-height: 150px; left: -7vw; bottom: -8vw; background: var(--sage); }
.visual-story-stage[data-tone="sun"] { background: var(--sun); color: var(--ink); border-radius: 4rem 1.5rem 4rem 1.5rem; }
.visual-story-stage[data-tone="sun"]::before { background: var(--sage); transform: translate(-10vw, 8vh) scale(.7); }
.visual-story-stage[data-tone="sun"]::after { background: var(--coral); transform: translate(10vw, -5vh) scale(.8); }
.visual-story-stage[data-tone="sage"] { background: var(--sage); border-radius: 1.5rem 4rem 1.5rem 4rem; }
.visual-story-stage[data-tone="sage"]::before { background: var(--sun); transform: translate(-8vw, 9vh); }
.visual-story-stage[data-tone="sage"]::after { background: var(--ink); transform: translate(8vw, -6vh) scale(.8); }
.visual-story-stage[data-tone="coral"] { background: var(--coral); color: var(--ink); border-radius: 4rem 1.5rem 1.5rem 4rem; }
.visual-story-stage[data-tone="coral"]::before { background: var(--sun); transform: translate(-8vw, 8vh) scale(.8); }
.visual-story-stage[data-tone="coral"]::after { background: var(--ink); transform: translate(8vw, -5vh); }
.visual-story-image { position: absolute; z-index: 0; inset: 7%; overflow: hidden; border-radius: 1.5rem 5rem 1.5rem 5rem; transition: inset .45s ease, border-radius .45s ease; }
.visual-story-stage[data-tone="sun"] .visual-story-image { inset: 9% 17% 10% 7%; border-radius: 5rem 1.5rem 5rem 1.5rem; }
.visual-story-stage[data-tone="sage"] .visual-story-image { inset: 7% 8% 13% 15%; border-radius: 1.5rem 5rem 1.5rem 5rem; }
.visual-story-stage[data-tone="coral"] .visual-story-image { inset: 10% 7% 8% 17%; border-radius: 5rem 1.5rem 1.5rem 5rem; }
.visual-story-image::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgba(11, 66, 81, .86)); }
.visual-story-image img { width: 100%; height: 100%; object-fit: cover; transition: opacity .18s ease, transform .35s ease; }
.visual-story-image img.is-changing { opacity: .2; transform: scale(1.04); }
.visual-story-caption { position: absolute; right: clamp(1.5rem, 4vw, 3rem); bottom: clamp(1.5rem, 4vw, 3rem); left: clamp(1.5rem, 4vw, 3rem); z-index: 1; }
.visual-story-caption .eyebrow { color: var(--sun); }
.visual-story-stage[data-tone="sun"] .visual-story-caption .eyebrow, .visual-story-stage[data-tone="coral"] .visual-story-caption .eyebrow { color: var(--ink); }
.visual-story-caption h3 { max-width: 620px; margin: .5rem 0; font-size: clamp(2.2rem, 4vw, 4.5rem); line-height: .95; }
.visual-story-caption p { max-width: 520px; margin: 0; font-size: 1.05rem; opacity: .86; }
.visual-story-steps { position: absolute; inset: 0; pointer-events: none; }
.visual-story-step { position: absolute; inset: 0; visibility: hidden; }
.story-step-number { color: var(--coral); font-size: .75rem; font-weight: 850; letter-spacing: .15em; }
.visual-story-step h3 { margin: .6rem 0 .4rem; font-size: clamp(1.65rem, 3vw, 2.6rem); }
.visual-story-step p { max-width: 320px; margin: 0; color: var(--ink-soft); font-size: 1rem; }
.visual-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 150px; gap: .85rem; }
.visual-card { position: relative; min-height: 150px; overflow: hidden; border-radius: 1.1rem; background: var(--ink); }
.visual-card.featured { grid-row: span 2; grid-column: span 2; }
.visual-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.visual-card:hover img { transform: scale(1.05); }
.visual-card::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(11, 66, 81, .8)); }
.visual-label { position: absolute; right: 1rem; bottom: .8rem; left: 1rem; z-index: 1; color: var(--paper); font-weight: 750; }
.lab-visual { position: relative; min-height: 155px; margin-bottom: 1.5rem; overflow: hidden; border-radius: 1.25rem; background: var(--ink); }
.lab-visual img { width: 100%; height: 155px; object-fit: cover; opacity: .8; }
.lab-visual-copy { position: absolute; inset: auto 1.25rem 1rem; color: var(--paper); }

.auth-layout { min-height: 72vh; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 3rem; }
.auth-intro { padding: 2rem 0; }
.auth-intro h1 { font-size: clamp(2.7rem, 5vw, 5rem); line-height: .95; }
.auth-intro h1 span { color: var(--coral); }
.auth-visual { position: relative; max-width: 520px; height: 190px; margin-top: 2rem; overflow: hidden; border-radius: 1.25rem; background: var(--ink); }
.auth-visual img { width: 100%; height: 100%; object-fit: cover; opacity: .86; }
.auth-visual::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(11, 66, 81, .76)); }
.auth-visual-label { position: absolute; right: 1.1rem; bottom: .9rem; left: 1.1rem; z-index: 1; color: var(--paper); font-weight: 750; }
.auth-card { padding: clamp(1.5rem, 4vw, 3rem); }
.auth-icon { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; margin-bottom: 1.25rem; border-radius: 1rem; background: var(--cream); font-size: 1.5rem; }
.form-control { min-height: 3rem; border: 1px solid var(--border); border-radius: .75rem; color: var(--ink); background: #fffdf8; }
.form-control:focus { border-color: var(--sage); box-shadow: 0 0 0 .2rem rgba(109, 148, 150, .2); }

.dashboard-header { padding: 2.25rem; margin-bottom: 1.5rem; background: var(--cream); border-radius: 1.5rem; }
.stat-card { height: 100%; padding: 1.5rem; border-radius: 1.2rem; background: var(--white); border: 1px solid var(--border); }
.stat-card.accent { background: var(--coral); color: var(--ink); }
.stat-card.alt { background: var(--sage); color: var(--paper); }
.admin-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.admin-action { display: flex; min-height: 150px; flex-direction: column; justify-content: space-between; padding: 1.4rem; border-radius: 1.2rem; text-decoration: none; background: var(--white); border: 1px solid var(--border); box-shadow: 0 8px 20px rgba(11, 66, 81, .06); }
.admin-action:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow); }
.admin-action:nth-child(2) { background: var(--sun); }
.admin-action:nth-child(3) { background: var(--sage); color: var(--paper); }

.table-wrap { padding: 1.25rem; overflow: hidden; }
.table { --bs-table-bg: transparent; color: var(--ink); vertical-align: middle; }
.table thead th { color: var(--ink-soft); border-bottom: 2px solid var(--border); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }
.table tbody td { border-color: var(--border); }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { border: 1px solid var(--border); border-radius: .6rem; padding: .4rem; }

@media (max-width: 768px) {
  .hero { min-height: 560px; }
  .hero-content { padding: 4rem 1.25rem; }
  .hero-mark { right: -35px; bottom: 8%; opacity: .45; }
  .auth-layout { grid-template-columns: 1fr; gap: 0; }
  .auth-intro { padding-bottom: 0; }
  .auth-visual { height: 150px; margin-top: 1.5rem; }
  .admin-actions { grid-template-columns: 1fr; }
  .visual-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 130px; }
  .visual-card.featured { grid-row: span 2; grid-column: span 2; }
  .visual-story-stage { height: 480px; }
  .visual-story-image, .visual-story-stage[data-tone="sun"] .visual-story-image, .visual-story-stage[data-tone="sage"] .visual-story-image, .visual-story-stage[data-tone="coral"] .visual-story-image { inset: 5%; border-radius: 1.5rem 3rem 1.5rem 3rem; }
  .visual-story-caption h3 { font-size: 2.5rem; }
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .authenticated-main { width: 100%; max-width: none; margin-left: 0; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open::after { position: fixed; z-index: 1020; inset: 66px 0 0; content: ""; background: rgba(11, 66, 81, .32); }
}
