/* =============================================================================================
   Event Manager theme - built on Bootstrap 5.3 colour modes (data-bs-theme="light" | "dark").
   Tokens first, then components. Keep colours as variables so both modes stay in sync.
   ============================================================================================= */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../lib/inter/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../lib/inter/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Tokens: light ------------------------------------------------------------------------ */
:root,
[data-bs-theme="light"] {
  --app-font: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --app-accent-1: #6366f1;
  --app-accent-2: #06b6d4;
  --app-gradient: linear-gradient(135deg, var(--app-accent-1) 0%, #8b5cf6 45%, var(--app-accent-2) 100%);

  --app-bg: #f4f5fa;
  --app-surface: #ffffff;
  --app-surface-2: #f8f9fc;
  --app-sidebar: #ffffff;
  --app-muted: #6b7280;
  --app-border: #e6e8f0;
  --app-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .06);
  --app-shadow-lg: 0 12px 40px rgba(16, 24, 40, .12);
  --app-hover: rgba(79, 70, 229, .06);

  --bs-body-font-family: var(--app-font);
  --bs-body-bg: var(--app-bg);
  --bs-body-color: #1f2433;
  --bs-emphasis-color: #0f1320;
  --bs-secondary-color: rgba(31, 36, 51, .68);
  --bs-border-color: var(--app-border);
  --bs-border-radius: .55rem;
  --bs-border-radius-lg: .9rem;
  --bs-border-radius-xl: 1.2rem;

  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-primary-text-emphasis: #3730a3;
  --bs-primary-bg-subtle: #e8e9ff;
  --bs-primary-border-subtle: #c7cbfb;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #3730a3;
  --bs-link-hover-color-rgb: 55, 48, 163;

  --app-btn-bg: #4f46e5;
  --app-btn-hover: #4338ca;
  --app-btn-active: #3730a3;
}

/* ---- Tokens: dark ------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
  --app-bg: #0b0e14;
  --app-surface: #131722;
  --app-surface-2: #181d2a;
  --app-sidebar: #0f131c;
  --app-muted: #9aa3b5;
  --app-border: #242a3a;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --app-shadow-lg: 0 16px 48px rgba(0, 0, 0, .45);
  --app-hover: rgba(129, 140, 248, .08);

  --bs-body-bg: var(--app-bg);
  --bs-body-color: #e3e6ee;
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: rgba(227, 230, 238, .66);
  --bs-secondary-bg: #1b2130;
  --bs-tertiary-bg: #151a26;
  --bs-border-color: var(--app-border);

  --bs-primary: #818cf8;
  --bs-primary-rgb: 129, 140, 248;
  --bs-primary-text-emphasis: #c7cbfd;
  --bs-primary-bg-subtle: rgba(99, 102, 241, .18);
  --bs-primary-border-subtle: #3b3f8f;
  --bs-link-color: #a5b4fc;
  --bs-link-color-rgb: 165, 180, 252;
  --bs-link-hover-color: #c7d2fe;
  --bs-link-hover-color-rgb: 199, 210, 254;

  --app-btn-bg: #6366f1;
  --app-btn-hover: #7376f4;
  --app-btn-active: #5558e6;
}

/* ---- Base ---------------------------------------------------------------------------------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-feature-settings: "cv11", "ss01"; letter-spacing: -0.005em; }
h1, h2, h3, .h1, .h2, .h3, .h4, .h5 { letter-spacing: -0.02em; font-weight: 650; color: var(--bs-emphasis-color); }
.h6, h6 { font-weight: 600; }
a { text-underline-offset: .2em; }
.text-small { font-size: .85rem; }
.text-muted { color: var(--app-muted) !important; }
::selection { background: rgba(var(--bs-primary-rgb), .25); }
.rich-text { white-space: pre-wrap; word-break: break-word; }

/* ---- App shell: sidebar + content ---------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 1.75rem 2rem 4rem; max-width: 1480px; width: 100%; margin: 0 auto; }

.sidebar.offcanvas-xl {
  --bs-offcanvas-width: 272px;
  --bs-offcanvas-bg: var(--app-sidebar);
  border-right: 1px solid var(--app-border);
}
@media (min-width: 1200px) {
  .sidebar.offcanvas-xl {
    width: 272px; flex: 0 0 272px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--app-sidebar) !important;
  }
}
.sidebar .offcanvas-body { display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem .9rem; height: 100%; }

.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--bs-emphasis-color); font-weight: 700; letter-spacing: -0.02em; }
.brand:hover { color: var(--bs-emphasis-color); }
.brand-mark {
  width: 2.1rem; height: 2.1rem; border-radius: .65rem; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--app-gradient); color: #fff; font-size: 1rem; box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.brand-name { line-height: 1.15; font-size: 1.02rem; }

.nav-section { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--app-muted); padding: .8rem .75rem .3rem; }
.side-nav .nav-link {
  display: flex; align-items: center; gap: .7rem; padding: .42rem .75rem; border-radius: .6rem;
  color: var(--bs-body-color); font-weight: 500; font-size: .93rem; position: relative;
  transition: background-color .15s ease, color .15s ease;
}
.side-nav .nav-link .bi { font-size: 1.08rem; color: var(--app-muted); transition: color .15s ease; }
.side-nav .nav-link:hover { background: var(--app-hover); color: var(--bs-emphasis-color); }
.side-nav .nav-link:hover .bi { color: var(--bs-primary); }
.side-nav .nav-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.side-nav .nav-link.active .bi { color: var(--bs-primary); }
.side-nav .nav-link.active::before {
  content: ""; position: absolute; left: -.9rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--app-gradient);
}

.edition-picker .form-select { background-color: var(--app-surface-2); font-weight: 600; font-size: .88rem; border-radius: .6rem; }
.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--app-border); display: flex; flex-direction: column; gap: .6rem; }

.user-chip { display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; border-radius: .65rem; color: var(--bs-body-color); text-decoration: none; width: 100%; border: 0; background: transparent; text-align: left; }
.user-chip:hover { background: var(--app-hover); }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: 0 0 auto;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
}

/* Segmented light / auto / dark switch */
.theme-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--app-surface-2); border: 1px solid var(--app-border); }
.theme-switch button {
  border: 0; background: transparent; color: var(--app-muted); width: 2.1rem; height: 1.8rem; border-radius: 999px; display: grid; place-items: center;
  transition: background-color .15s ease, color .15s ease;
}
.theme-switch button:hover { color: var(--bs-emphasis-color); }
.theme-switch button.active { background: var(--app-surface); color: var(--bs-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Mobile top bar */
.topbar {
  position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem;
  background: color-mix(in srgb, var(--app-bg) 80%, transparent); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--app-border);
}
.icon-btn { border: 1px solid var(--app-border); background: var(--app-surface); color: var(--bs-body-color); width: 2.4rem; height: 2.4rem; border-radius: .6rem; display: grid; place-items: center; }

@media (max-width: 767.98px) { .app-content { padding: 1.1rem 1rem 3rem; } }

/* ---- Cards ---------------------------------------------------------------------------------- */
.card {
  --bs-card-bg: var(--app-surface);
  --bs-card-border-color: var(--app-border);
  --bs-card-cap-bg: transparent;
  --bs-card-border-radius: var(--bs-border-radius-lg);
  --bs-card-inner-border-radius: calc(var(--bs-border-radius-lg) - 1px);
  --bs-card-cap-padding-y: .8rem;
  --bs-card-cap-padding-x: 1.1rem;
  --bs-card-spacer-x: 1.1rem;
}
.card.shadow-sm, .shadow-sm { box-shadow: var(--app-shadow) !important; }
.card-header { border-bottom-color: var(--app-border); }
.card-header .h6, .card-header h2.h6 { font-weight: 650; }
.section-heading { background: var(--app-surface-2) !important; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); }
.card.border-success, .card.border-success-subtle { border-color: var(--bs-success-border-subtle) !important; }
.card.border-danger-subtle { border-color: var(--app-border) !important; }
.card.border-danger-subtle .card-header h2 { color: var(--bs-danger-text-emphasis) !important; }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--app-border); }

/* Page header */
main h1.h3 { font-size: 1.65rem; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--app-muted); font-size: .85rem; }

/* ---- Buttons ------------------------------------------------------------------------------- */
.btn { --bs-btn-font-weight: 550; border-radius: .6rem; }
.btn-sm { border-radius: .5rem; }
.btn-primary {
  --bs-btn-bg: var(--app-btn-bg); --bs-btn-border-color: var(--app-btn-bg);
  --bs-btn-hover-bg: var(--app-btn-hover); --bs-btn-hover-border-color: var(--app-btn-hover);
  --bs-btn-active-bg: var(--app-btn-active); --bs-btn-active-border-color: var(--app-btn-active);
  --bs-btn-disabled-bg: var(--app-btn-bg); --bs-btn-disabled-border-color: var(--app-btn-bg);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 12px rgba(var(--bs-primary-rgb), .25);
}
.btn-outline-primary {
  --bs-btn-color: var(--bs-primary); --bs-btn-border-color: rgba(var(--bs-primary-rgb), .45);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--app-btn-bg); --bs-btn-hover-border-color: var(--app-btn-bg);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--app-btn-active); --bs-btn-active-border-color: var(--app-btn-active);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color); --bs-btn-border-color: var(--app-border); --bs-btn-bg: var(--app-surface);
  --bs-btn-hover-color: var(--bs-emphasis-color); --bs-btn-hover-bg: var(--app-surface-2); --bs-btn-hover-border-color: var(--app-border);
  --bs-btn-active-color: var(--bs-emphasis-color); --bs-btn-active-bg: var(--app-surface-2); --bs-btn-active-border-color: var(--app-border);
}
.btn-success { box-shadow: 0 4px 12px rgba(25, 135, 84, .25); }
.btn-link { --bs-btn-color: var(--bs-link-color); --bs-btn-hover-color: var(--bs-link-hover-color); }

/* ---- Forms --------------------------------------------------------------------------------- */
.form-control, .form-select { border-radius: .6rem; background-color: var(--app-surface); border-color: var(--app-border); }
.form-control:focus, .form-select:focus { border-color: rgba(var(--bs-primary-rgb), .65); box-shadow: 0 0 0 .22rem rgba(var(--bs-primary-rgb), .18); }
.form-check-input { border-color: color-mix(in srgb, var(--app-muted) 55%, transparent); }
.form-check-input:checked { background-color: var(--app-btn-bg); border-color: var(--app-btn-bg); }
.form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .65); box-shadow: 0 0 0 .22rem rgba(var(--bs-primary-rgb), .18); }
.form-label { font-weight: 550; font-size: .9rem; }
textarea.form-control { min-height: 6rem; }
.input-group > .form-control { border-radius: .6rem 0 0 .6rem; }

/* ---- Tables -------------------------------------------------------------------------------- */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--app-border); --bs-table-hover-bg: var(--app-hover); --bs-table-hover-color: inherit; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .8rem; }
.table-sm > :not(caption) > * > * { padding: .5rem .65rem; }
.table thead.table-head th, .table .table-head th {
  background: var(--app-surface-2); color: var(--app-muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--app-border); white-space: nowrap;
}
.table tfoot td { background: var(--app-surface-2); }
.table-row-muted > * { background: var(--app-surface-2) !important; }
.task-title { font-weight: 550; text-decoration: none; color: var(--bs-emphasis-color); }
a.task-title:hover { color: var(--bs-primary); text-decoration: underline; }
.task-row.closed .task-title { text-decoration: line-through; color: var(--app-muted); }
.task-row.retired { opacity: .55; }

/* ---- Badges -------------------------------------------------------------------------------- */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 999px; padding: .32em .65em; }
.badge.bg-body-secondary { border-color: var(--app-border) !important; }

/* ---- Stats / dashboard --------------------------------------------------------------------- */
.stat { font-size: 1.75rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; }
.stat-tile { display: flex; flex-direction: row; align-items: center; gap: .85rem; padding: 1rem 1.1rem; height: 100%; text-decoration: none; color: inherit; }
a.stat-tile:hover { color: inherit; }
a.stat-tile:hover .stat-label { color: var(--bs-primary); }
.stat-icon { width: 2.6rem; height: 2.6rem; border-radius: .75rem; display: grid; place-items: center; font-size: 1.2rem; flex: 0 0 auto; }
.stat-label { font-size: .8rem; color: var(--app-muted); font-weight: 500; }
.tone-primary { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.tone-success { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.tone-danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.tone-warning { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.tone-info { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }
.tone-muted { background: var(--bs-secondary-bg); color: var(--app-muted); }

.hero {
  position: relative; overflow: hidden; color: #fff; border: 0 !important;
  background: var(--app-gradient) !important; box-shadow: 0 12px 32px rgba(99, 102, 241, .35) !important;
}
.hero::after {
  content: ""; position: absolute; width: 18rem; height: 18rem; right: -6rem; top: -7rem; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 70%); pointer-events: none;
}
.hero .card-body { position: relative; z-index: 1; }
.hero h1, .hero .h4 { color: #fff; }
.hero .text-muted, .hero .hero-sub { color: rgba(255, 255, 255, .82) !important; }
.hero a { color: #fff; }
.hero .badge { background: rgba(255, 255, 255, .2) !important; color: #fff !important; border: 1px solid rgba(255, 255, 255, .3); }
.countdown { font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.hero-notes { background: rgba(255, 255, 255, .14); border-radius: .7rem; padding: .7rem .85rem; font-size: .85rem; }

.progress { --bs-progress-bg: var(--bs-secondary-bg); --bs-progress-border-radius: 999px; --bs-progress-bar-bg: var(--app-btn-bg); }
.progress-bar.bg-success { background: linear-gradient(90deg, #10b981, #34d399) !important; }

/* ---- Jobs ---------------------------------------------------------------------------------- */
.note { border-left: 3px solid rgba(var(--bs-primary-rgb), .35); padding-left: .85rem; }
.note.system { border-left-color: var(--app-border); color: var(--app-muted); font-size: .88rem; }
.guidance-empty { border-color: var(--bs-warning-border-subtle) !important; background: var(--bs-warning-bg-subtle) !important; }
details > summary { cursor: pointer; }

/* ---- Files --------------------------------------------------------------------------------- */
.file-icon { font-size: 1.15rem; margin-right: .4rem; vertical-align: -.12em; }
.drop-zone { position: relative; min-height: 14rem; }
.drop-overlay { display: none; }
.drop-zone.dragging .drop-overlay {
  display: flex; position: absolute; inset: 0; z-index: 5; align-items: center; justify-content: center; gap: .6rem;
  background: rgba(var(--bs-primary-rgb), .1); border: 2px dashed var(--bs-primary); border-radius: var(--bs-border-radius-lg);
  font-size: 1.3rem; font-weight: 650; color: var(--bs-primary); pointer-events: none; backdrop-filter: blur(2px);
}

/* ---- Dropdowns, alerts --------------------------------------------------------------------- */
.dropdown-menu {
  --bs-dropdown-bg: var(--app-surface); --bs-dropdown-border-color: var(--app-border); --bs-dropdown-border-radius: .75rem;
  --bs-dropdown-link-hover-bg: var(--app-hover); --bs-dropdown-link-active-bg: var(--app-btn-bg); --bs-dropdown-box-shadow: var(--app-shadow-lg);
  box-shadow: var(--app-shadow-lg); padding: .4rem;
}
.dropdown-item { border-radius: .45rem; }
.alert { border-radius: .75rem; }
.validation-summary-valid { display: none; }

/* ---- Sign-in pages ------------------------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; position: relative; overflow: hidden; }
.auth-shell::before, .auth-shell::after {
  content: ""; position: absolute; width: 38rem; height: 38rem; border-radius: 50%; filter: blur(90px); opacity: .35; z-index: 0; pointer-events: none;
}
.auth-shell::before { background: #6366f1; top: -16rem; left: -12rem; }
.auth-shell::after { background: #06b6d4; bottom: -18rem; right: -12rem; }
[data-bs-theme="dark"] .auth-shell::before, [data-bs-theme="dark"] .auth-shell::after { opacity: .22; }
.auth-shell > * { position: relative; z-index: 1; }
.auth-shell .container-auth { width: 100%; max-width: 1100px; }
.auth-shell .card { backdrop-filter: blur(10px); background: color-mix(in srgb, var(--app-surface) 88%, transparent); box-shadow: var(--app-shadow-lg) !important; }
.auth-corner { position: absolute; top: 1rem; right: 1rem; z-index: 2; }
.auth-brand { margin-bottom: 1.5rem; }
.auth-brand .brand-mark { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; }
.auth-brand .brand-name { font-size: 1.25rem; }

/* ---- Print --------------------------------------------------------------------------------- */
@media print {
  .sidebar, .topbar { display: none !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none !important; }
  .app-content { padding: 0; }
  a { text-decoration: none; color: inherit; }
}

/* ---- Mailbox ------------------------------------------------------------------------------- */
.mail-folders .list-group-item { border: 0; font-size: .92rem; padding-top: .45rem; padding-bottom: .45rem; }
.mail-folders .list-group-item .bi { color: var(--app-muted); }
.mail-folders .active-folder { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.mail-folders .active-folder .bi { color: var(--bs-primary); }
.mail-row { display: grid; grid-template-columns: .6rem minmax(8rem, 14rem) 1fr auto; gap: .75rem; align-items: center; padding: .65rem 1rem; color: var(--bs-body-color); }
.mail-row .mail-dot { width: .5rem; height: .5rem; border-radius: 50%; }
.mail-row.unread .mail-dot { background: var(--bs-primary); }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 650; color: var(--bs-emphasis-color); }
.mail-row .mail-from { font-size: .9rem; }
.mail-row .mail-subject { font-size: .9rem; color: var(--app-muted); }
.mail-row .mail-meta { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--app-muted); white-space: nowrap; }
.mail-row .mail-date { min-width: 3.6rem; text-align: right; }
@media (max-width: 767.98px) {
  .mail-row { grid-template-columns: .6rem 1fr auto; grid-template-areas: "dot from meta" "dot subject subject"; row-gap: .1rem; }
  .mail-row .mail-dot { grid-area: dot; } .mail-row .mail-from { grid-area: from; } .mail-row .mail-subject { grid-area: subject; } .mail-row .mail-meta { grid-area: meta; }
}
.mail-frame { width: 100%; min-height: 24rem; border: 0; border-top: 1px solid var(--app-border); background: #fff; border-radius: 0 0 var(--bs-border-radius-lg) var(--bs-border-radius-lg); display: block; }
.remote-bar { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-top: 1px solid var(--app-border); }
.attachment-chip {
  display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; padding: .4rem .7rem; border-radius: .6rem; text-decoration: none;
  border: 1px solid var(--app-border); background: var(--app-surface-2); color: var(--bs-body-color); font-size: .85rem;
}
.attachment-chip:hover { border-color: rgba(var(--bs-primary-rgb), .5); color: var(--bs-emphasis-color); }
.email-snapshot { border-left: 3px solid rgba(var(--bs-primary-rgb), .35); padding-left: .85rem; }
.compose-field { display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid var(--app-border); padding: .15rem 0; }
.compose-field label { width: 4.2rem; flex: 0 0 auto; color: var(--app-muted); font-size: .88rem; font-weight: 550; }
.compose-field .form-control { border: 0; box-shadow: none !important; background: transparent; padding-left: 0; }
.compose-body { min-height: 18rem; font-size: .95rem; line-height: 1.55; border: 0; box-shadow: none !important; background: transparent; padding-left: 0; resize: vertical; }
.attach-item { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border: 1px solid var(--app-border); border-radius: .5rem; margin-bottom: .35rem; background: var(--app-surface-2); }
.attach-item .text-truncate { flex: 1 1 auto; min-width: 0; }
.job-picker { max-height: 16rem; overflow-y: auto; }

/* ---- Email editor ------------------------------------------------------------------------- */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .25rem .5rem; padding: .35rem; border: 1px solid var(--app-border); border-bottom: 0; border-radius: .6rem .6rem 0 0; background: var(--app-surface-2); }
.editor-toolbar .tb-group { display: flex; gap: 2px; padding-right: .5rem; border-right: 1px solid var(--app-border); }
.editor-toolbar .tb-group:last-child { border-right: 0; }
.editor-toolbar .tb { border: 0; background: transparent; color: var(--bs-body-color); width: 2rem; height: 2rem; border-radius: .45rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.editor-toolbar .tb-wide { width: auto; padding: 0 .4rem; gap: .15rem; }
.editor-toolbar .tb-caret { font-size: .6rem; opacity: .7; }
.editor-toolbar .tb:hover { background: var(--app-hover); color: var(--bs-emphasis-color); }
.editor-toolbar .tb.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.swatches { display: grid; grid-template-columns: repeat(5, 1.6rem); gap: .35rem; }
.swatch { width: 1.6rem; height: 1.6rem; border-radius: .4rem; border: 1px solid rgba(0, 0, 0, .15); padding: 0; }
.swatch:hover { transform: scale(1.12); }
.swatch-none { background: linear-gradient(to top right, #fff calc(50% - 1px), #d33 50%, #fff calc(50% + 1px)) !important; }
/* The message area is always white, so what you see is what recipients see. */
.mail-editor {
  min-height: 18rem; max-height: 60vh; overflow-y: auto; padding: .9rem 1rem; border: 1px solid var(--app-border); border-radius: 0 0 .6rem .6rem;
  background: #fff; color: #1f2433; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; line-height: 1.45; outline: none;
}
.mail-editor:focus { border-color: rgba(var(--bs-primary-rgb), .65); box-shadow: 0 0 0 .22rem rgba(var(--bs-primary-rgb), .18); }
.mail-editor a { color: #1e5fd6; }
.mail-editor blockquote { margin: .3rem 0 .3rem .6rem; padding-left: .8rem; border-left: 3px solid #c9cde0; color: #444; }
.mail-editor ul, .mail-editor ol { padding-left: 1.6rem; margin: .2rem 0; }
.mail-editor p { margin: 0; }

/* ---- File viewer -------------------------------------------------------------------------- */
.preview-image { background: repeating-conic-gradient(var(--app-surface-2) 0% 25%, var(--app-surface) 0% 50%) 50% / 24px 24px;
  border: 1px solid var(--app-border); border-radius: var(--bs-border-radius-lg); display: flex; justify-content: center; align-items: center;
  min-height: 60vh; max-height: calc(100vh - 11rem); overflow: auto; cursor: zoom-in; }
.preview-image img { max-width: 100%; max-height: calc(100vh - 12rem); object-fit: contain; display: block; }
.preview-image.zoomed { cursor: zoom-out; justify-content: flex-start; align-items: flex-start; }
.preview-image.zoomed img { max-width: none; max-height: none; }
.pdf-viewer { border: 1px solid var(--app-border); border-radius: var(--bs-border-radius-lg); background: var(--app-surface-2); overflow: hidden; }
.pdf-toolbar { display: flex; align-items: center; gap: .4rem; padding: .5rem .75rem; border-bottom: 1px solid var(--app-border); background: var(--app-surface); position: sticky; top: 0; z-index: 2; }
.pdf-pages { padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; overflow-x: auto; min-height: 60vh; }
.pdf-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); flex: 0 0 auto; }
.pdf-page canvas { display: block; }
.docx-page { background: #fff; color: #1f2433; max-width: 52rem; margin: 0 auto; padding: 2.5rem 3rem; border-radius: .4rem; font-family: Calibri, Arial, sans-serif; font-size: 11pt; line-height: 1.45; }
.docx-page h1, .docx-page h2, .docx-page h3, .docx-page h4 { color: #1f3864; }
.docx-page p { margin: 0 0 .5rem; }
.docx-page a { color: #1e5fd6; }
.docx-page img { max-width: 100%; height: auto; }
.docx-page table, .docx-page .docx-table { border-collapse: collapse; margin: .5rem 0 1rem; width: 100%; }
.docx-page td { border: 1px solid #c9cde0; padding: .3rem .5rem; vertical-align: top; }
.docx-page td p { margin: 0; }
.docx-page blockquote { border-left: 3px solid #c9cde0; margin: .5rem 0; padding-left: .8rem; color: #444; }
@media (max-width: 767.98px) { .docx-page { padding: 1.2rem 1rem; } }
.preview-table-tools { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.preview-table-tools input { max-width: 18rem; }
.preview-table-wrap { overflow: auto; max-height: calc(100vh - 15rem); border: 1px solid var(--app-border); border-radius: .5rem; }
.preview-table { font-size: .85rem; margin: 0; }
.preview-table thead th { position: sticky; top: 0; background: var(--app-surface-2); z-index: 1; white-space: nowrap; }
.preview-table thead th[data-sort=asc]::after { content: " ▲"; font-size: .7em; }
.preview-table thead th[data-sort=desc]::after { content: " ▼"; font-size: .7em; }
.preview-table td { max-width: 28rem; white-space: pre-wrap; }
.preview-sheet th.rownum { position: sticky; left: 0; background: var(--app-surface-2); color: var(--app-muted); text-align: right; font-weight: 500; z-index: 1; }
.preview-sheet thead th { text-align: center; color: var(--app-muted); font-weight: 500; }
.preview-sheet-tabs { margin-bottom: .75rem; flex-wrap: nowrap; overflow-x: auto; }
.attachment-chip .preview-dl { padding-left: .4rem; border-left: 1px solid var(--app-border); }

/* ---- Guidance request page ---------------------------------------------------------------- */
.guidance-page { max-width: 62rem; margin: 0 auto; }
.guidance-job > details > summary { cursor: pointer; list-style: none; }
.guidance-job > details > summary::-webkit-details-marker { display: none; }
.guidance-job > details > summary::before { content: "\F285"; font-family: "bootstrap-icons"; color: var(--app-muted); transition: transform .15s; }
.guidance-job > details[open] > summary::before { transform: rotate(90deg); }
.guidance-tools .btn-group .btn { white-space: nowrap; }

/* Email previews (guidance wording, Settings → Email previews) */
.email-preview { display: block; width: 100%; height: 72vh; min-height: 420px; border: 0; background: #f3f4f8; border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius); }
.template-editor { min-height: 22rem; }
.template-editor p { margin: 0 0 .75rem; }
.template-editor ul, .template-editor ol { margin-bottom: .75rem; }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }

/* Marshal maps */
.course-map { height: 460px; border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius); }
.slot-map { height: 260px; }
.map-pin-wrap { background: none; border: 0; }
.map-pin { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #4f46e5; color: #fff; font: 700 12px/1 Inter, system-ui, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.map-pin-vacant { background: #d97706; }
.leaflet-container { font-family: inherit; }
@media print { .course-map { height: 600px; } }
