/* =====================================================
   THEMES — CSS custom properties
   ===================================================== */

/* System: follows OS preference */
:root {
  --bg: #f7f9fc;
  --bg-nav: #e6eef8;
  --bg-card: #e6eef8;
  --bg-input: #ffffff;
  --bg-inactive: #eaf0f6;
  --bg-menu: #ffffff;
  --bg-btn: #c0dcf8;
  --text: #141c2c;
  --text-muted: #505868;
  --text-nav: #1a2030;
  --text-btn: #00527a;
  --border: #c4d4e6;
  --accent: #0077aa;
  --shadow: rgba(60, 90, 140, 0.10);
  --shadow-nav: 0 2px 8px rgba(60, 90, 140, 0.13);
  --shadow-card: 0 1px 4px rgba(60, 90, 140, 0.11);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c2433;
    --bg-nav: #232d3e;
    --bg-card: #2a3548;
    --bg-input: #2a3548;
    --bg-inactive: #1c2433;
    --bg-menu: #2a3548;
    --bg-btn: #24486a;
    --text: #dde4f0;
    --text-muted: #8a9ab4;
    --text-nav: #dde4f0;
    --text-btn: #ffffff;
    --border: rgba(255, 255, 255, 0.09);
    --accent: #4cb8d4;
    --shadow: rgba(0, 0, 0, 0.30);
    --shadow-nav: 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.20);
    color-scheme: dark;
  }
}

body.theme-light {
  --bg: #f7f9fc;
  --bg-nav: #e6eef8;
  --bg-card: #e6eef8;
  --bg-input: #ffffff;
  --bg-inactive: #eaf0f6;
  --bg-menu: #ffffff;
  --bg-btn: #c0dcf8;
  --text: #141c2c;
  --text-muted: #505868;
  --text-nav: #1a2030;
  --text-btn: #00527a;
  --border: #c4d4e6;
  --accent: #0077aa;
  --shadow: rgba(60, 90, 140, 0.10);
  --shadow-nav: 0 2px 8px rgba(60, 90, 140, 0.13);
  --shadow-card: 0 1px 4px rgba(60, 90, 140, 0.11);
  color-scheme: light;
}

body.theme-dark {
  --bg: #1c2433;
  --bg-nav: #232d3e;
  --bg-card: #2a3548;
  --bg-input: #2a3548;
  --bg-inactive: #1c2433;
  --bg-menu: #2a3548;
  --bg-btn: #24486a;
  --text: #dde4f0;
  --text-muted: #8a9ab4;
  --text-nav: #dde4f0;
  --text-btn: #ffffff;
  --border: rgba(255, 255, 255, 0.09);
  --accent: #4cb8d4;
  --shadow: rgba(0, 0, 0, 0.30);
  --shadow-nav: 0 2px 8px rgba(0, 0, 0, 0.30);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.20);
  color-scheme: dark;
}

body.theme-sunset {
  --bg: #fff7f0;
  --bg-nav: #ffdec4;
  --bg-card: #ffecdc;
  --bg-input: #fffaf6;
  --bg-inactive: #fddcc4;
  --bg-menu: #fff7f0;
  --bg-btn: #ffd0a0;
  --text: #3a1400;
  --text-muted: #8a5628;
  --text-nav: #5a2800;
  --text-btn: #8c3800;
  --border: #f8c088;
  --accent: #d05010;
  --shadow: rgba(160, 60, 0, 0.09);
  --shadow-nav: 0 2px 8px rgba(160, 60, 0, 0.12);
  --shadow-card: 0 1px 4px rgba(160, 60, 0, 0.07);
  color-scheme: light;
}

body.theme-ocean {
  --bg: #f0f8ff;
  --bg-nav: #c4e8f8;
  --bg-card: #d8f0fc;
  --bg-input: #f4fbff;
  --bg-inactive: #c8e4f4;
  --bg-menu: #f0f8ff;
  --bg-btn: #98d0ec;
  --text: #08202e;
  --text-muted: #246880;
  --text-nav: #08202e;
  --text-btn: #005070;
  --border: #88c8e4;
  --accent: #0080cc;
  --shadow: rgba(0, 80, 130, 0.09);
  --shadow-nav: 0 2px 8px rgba(0, 80, 130, 0.12);
  --shadow-card: 0 1px 4px rgba(0, 80, 130, 0.07);
  color-scheme: light;
}



/* =====================================================
   RESET & BASE
   ===================================================== */

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

select,
input {
  background-color: var(--bg-input);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}


/* =====================================================
   NAV
   ===================================================== */

nav {
  position: relative;
  height: 4rem;
  background: var(--bg-nav);
  color: var(--text-nav);
  top: 0;
  display: flex;
  justify-content: left;
  align-items: center;
  padding-left: 0.6em;
  font-size: 1.2rem;
  z-index: 1000;
  box-shadow: var(--shadow-nav);
}

#ttlName {
  color: var(--text-muted);
  padding: 0 .9rem 0 0;
  border-right: 1px solid var(--border);
}

#ttlBarTxt {
  color: var(--text-nav);
  font-weight: 500;
}

#hamburger {
  position: absolute;
  right: 1.1rem;
  cursor: pointer;
  background-color: transparent;
  border: 0;
  color: var(--text-nav);
  font-size: 2rem;
  width: 2rem;
  text-align: center;
  padding: 0;
  line-height: 1;
}

#menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0.7rem;
  font-size: .9rem;
  font-weight: 400;
  padding: 0.3rem 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-menu);
  box-shadow: 0 6px 20px var(--shadow);
  min-width: 160px;
  overflow: hidden;
  z-index: 2000;
}

#menu a {
  display: block;
  padding: 0.85rem 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}

#menu a:hover,
#menu a:active {
  background-color: var(--bg-card);
}


/* =====================================================
   BACK ARROW
   ===================================================== */

.icon {
  transform: translate(-20%, -10%);
  width: 3rem;
  height: 3.5rem;
  cursor: pointer;
}

.arrow {
  background-color: var(--text-nav);
  position: absolute;
  top: 2rem;
  left: 1.3rem;
  width: 1rem;
  height: 1px;
}

.arrow::after,
.arrow::before {
  content: '';
  position: absolute;
  width: .7rem;
  height: .1rem;
  right: 0.5rem;
}

.arrow::after {
  background-color: var(--text-nav);
  top: -4px;
  transform: rotate(-45deg);
}

.arrow::before {
  background-color: var(--text-nav);
  top: 3px;
  transform: rotate(45deg);
}


.back-a {
  display: flex;
  align-items: center;
}


#navbar-order {
  color: var(--text-nav);
}


/* =====================================================
   BUTTONS
   ===================================================== */

.btn-basic {
  background-color: var(--bg-btn);
  border-radius: 20px;
  color: var(--text-btn);
  font-weight: 600;
  font-size: .85rem;
  padding: .6rem 1.3rem;
  border: 0;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.btn-basic:active {
  filter: brightness(0.92);
  transform: scale(0.97);
}

.dayBtnDrk {
  filter: brightness(0.93) saturate(1.1);
}



/* =====================================================
   CONTAINER
   ===================================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}


/* =====================================================
   LOGIN / INDEX
   ===================================================== */

.comp-title {
  font-size: 2.8rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-weight: 300;
  color: var(--accent);
  padding: 0;
  text-align: center;
  margin: 7.6rem 0 1.5rem 0;
  letter-spacing: 1px;
}

@media (min-width: 768px) {
  .comp-title {
    margin-top: 16rem;
  }
}

.comp-title.demo-title {
  margin-top: 3.5rem;
}

@media (min-width: 768px) {
  .comp-title.demo-title {
    margin-top: 8rem;
  }
}

.demo-banner {
  max-width: 28rem;
  margin: 0 auto 0.5rem auto;
  padding: 0.75rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}

.nav-demo {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
  color: var(--text-btn);
  background: var(--bg-btn);
  border-radius: 999px;
}

.loginBox {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 1rem auto;
  max-width: 30rem;
}

.loginInput {
  font-size: 1rem;
  color: var(--text);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  margin: .45rem 1rem;
  width: 88%;
  padding: 0 1rem;
  height: 3.2rem;
  border-radius: 10px;
  transition: border-color 0.2s;
  outline: none;
}

.loginInput:focus {
  border-color: var(--accent);
}

#loginBtn {
  margin-top: 1.2rem;
  padding: .75rem 2.8rem;
  border-radius: 30px;
  font-size: .95rem;
}

#version {
  position: fixed;
  top: 0;
  right: 0;
  padding: 10px;
  font-size: .8rem;
  color: var(--text-muted);
}

#authMess {
  font-size: .95rem;
  color: #cc2222;
  display: flex;
  justify-content: center;
  padding: .5rem 1rem;
  margin-top: .8rem;
  visibility: hidden;
  border-radius: 8px;
}

#installBanner {
  visibility: hidden;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .9rem;
  padding: 8px 14px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  color: var(--text-muted);
}

#iosInstallBanner {
  display: none;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  font-size: .9rem;
  padding: 1rem 0 .2rem 0;
  padding-bottom: max(.2rem, env(safe-area-inset-bottom));
  color: var(--text-muted);
  text-align: center;
  line-height: 1.8rem;
}

.installDismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 10px;
  cursor: pointer;
  opacity: .7;
}

.installDismiss:active {
  opacity: 1;
}

#iosInstallBanner .installDismiss {
  position: absolute;
  top: 4px;
  right: 6px;
}

#iosShareImg {
  width: 1.4rem;
  margin: 0 .2rem;
}

#installButton {
  padding: 12px 24px;
  border: 1.5px solid var(--accent);
  background: none;
  font-size: .9rem;
  color: var(--accent);
  cursor: pointer;
  border-radius: 10px;
  margin: 6px;
  box-shadow: 0 2px 8px var(--shadow);
  transition: background 0.15s;
}

#installButton:active {
  background: var(--bg-card);
}


/* =====================================================
   GRID VIEW
   ===================================================== */

#noEventsFlex {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
}

#noEventsMess {
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 1.2rem 0;
}

#dateInputBox {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#dateDisplay {
  background-color: var(--bg-card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .4rem .9rem;
  font-size: .9rem;
  font-family: inherit;
  text-align: center;
  height: 2.6rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

#dateInput {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

#prevDayBtn,
#nextDayBtn {
  height: 2.6rem;
  width: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.grid-box {
  display: flex;
  justify-content: center;
}

/* Multi-day column layout (wide screens) */
.grid-multi {
  display: flex;
  gap: .8rem;
  padding: 1rem .8rem;
  align-items: flex-start;
  width: 100%;
}

.grid-day-col {
  flex: 1;
  min-width: 0;
}

.grid-day-header {
  font-size: .85rem;
  font-weight: 600;
  /* Slightly darker than --text-muted for column date labels */
  color: color-mix(in srgb, var(--text-muted) 55%, var(--text));
  text-align: center;
  padding: .45rem .2rem;
  margin-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}

/* Weekend (Sat/Sun) headers get a subtle green tint. */
.grid-day-header.weekend {
  color: color-mix(in srgb, color-mix(in srgb, var(--text-muted) 55%, var(--text)) 45%, #3a9a5c);
}

.grid-day-col .grid-scroll {
  margin-top: 0;
  width: 100%;
  padding: 0;
}

.grid-scroll li.no-events-day {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0;
  list-style: none;
  pointer-events: none;
  font-style: italic;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 0;
}

.grid-scroll {
  margin-top: 1rem;
  width: 94%;
  list-style: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.grid-scroll li {
  position: relative;
  padding: .85rem 1rem;
  margin: .6rem 0;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
  box-sizing: border-box;
}

/* Min-height from ttl_hours (≤1h = content size; 10h = 46vh). Content can
   still grow the card taller than the scaled floor. */
.grid-scroll li.evt-card {
  height: auto;
  min-height: var(--evt-h, 0);
  flex-shrink: 0;
}

/* Job-account letter group → soft spectrum tint mixed into the theme card bg. */
.grid-scroll li.evt-card.evt-acct-color {
  background-color: color-mix(in srgb, hsl(var(--evt-hue) 42% 52%) 18%, var(--bg-card));
  border-color: color-mix(in srgb, hsl(var(--evt-hue) 36% 46%) 14%, var(--border));
}

@media (hover: hover) {
  .grid-scroll li:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  }
}

.grid-scroll li:active {
  transform: scale(0.99);
  filter: brightness(0.97);
}

/* Card header: time range on the left, total hours quietly on the right,
   sharing a baseline like a calendar entry. */
.grid-scroll .evt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
}

.evt-hours {
  flex-shrink: 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Single-day layout wrapper — stacks the event list and the add button. */
.grid-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 94%;
}

.grid-single .grid-scroll {
  width: 100%;
}

/* "Add event" button shown under each day's cards. */
.add-event-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: .5rem 0;
  padding: .6rem 0;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background-color: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.grid-day-col .add-event-btn {
  padding: .45rem 0;
}

.add-event-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--bg-card);
}

.add-event-btn:active {
  filter: brightness(0.96);
}

.add-event-plus {
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}


/* Event card typography — clear hierarchy: time is the card title, then the
   subject, then a divided block of job details. */

/* Time range acts as the card title. */
.grid-scroll .evt-time {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  pointer-events: none;
}

/* Subject line, secondary to the time. */
.grid-scroll .evt-subject {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.35;
  margin-top: .2rem;
  pointer-events: none;
}

/* Unlabeled detail rows (job header, job account, sales customer, order no),
   separated from the header block above by a thin divider. */
.grid-scroll .evt-meta {
  font-size: .8rem;
  line-height: 1.55;
  color: color-mix(in srgb, var(--text-muted) 45%, var(--text));
  overflow-wrap: anywhere;
  pointer-events: none;
}

.grid-scroll .evt-subject + .evt-meta {
  margin-top: .55rem;
  padding-top: .5rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, var(--text-muted));
}

/* Overlap cluster: dashed well like the + button, not an error state.
   Single-day: cards sit in columns. Multi-day: stack with a left rail
   so narrow day columns stay readable. */
.grid-scroll li.evt-ol {
  padding: .4rem .45rem .5rem;
  margin: .6rem 0;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 34%, var(--border));
  background-color: color-mix(in srgb, var(--accent) 6%, var(--bg));
  border-radius: 14px;
  box-shadow: none;
  cursor: default;
  list-style: none;
}

@media (hover: hover) {
  .grid-scroll li.evt-ol:hover {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  }
}

.grid-scroll li.evt-ol:active {
  transform: none;
  filter: none;
}

.evt-ol-cap {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-muted) 35%, var(--accent));
  text-align: center;
  padding: .05rem 0 .35rem;
  pointer-events: none;
}

.evt-ol-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
  align-items: start;
}

.grid-single .evt-ol-row {
  grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
}

.grid-multi .evt-ol-row {
  grid-template-columns: 1fr;
  gap: .35rem;
  padding-left: .55rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 48%, var(--border));
}

.grid-multi .evt-ol-row .evt-ol-card {
  grid-column: 1;
}

.grid-scroll .evt-ol-row li.evt-card {
  margin: 0;
  width: 100%;
  min-width: 0;
  cursor: pointer;
}

.grid-single .evt-ol-row .evt-ol-card {
  padding: .75rem .7rem;
}

.grid-day-col .evt-ol-row .evt-ol-card {
  padding: .7rem .7rem;
}

.evt-ol-row .evt-time {
  font-size: .88rem;
}

.evt-ol-row .evt-meta {
  overflow-wrap: break-word;
}


/* =====================================================
   EVENT VIEW
   ===================================================== */

.evContainer {
  max-width: 50rem;
  overflow-x: hidden;
}

/* Quick-fill preset tabs (event form) */
.ev-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: .45rem;
  margin: 1rem 1rem 0;
  padding: .15rem 0 .2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ev-tabs::-webkit-scrollbar {
  display: none;
}

/* Invisible but still takes layout space (edit existing event). */
.ev-tabs.inv {
  visibility: hidden;
  pointer-events: none;
}

.ev-tab {
  flex: 0 0 auto;
  margin: 0;
  padding: .45rem .95rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.ev-tab:active {
  transform: scale(0.96);
}

.ev-tab.on {
  background: var(--bg-btn);
  border-color: transparent;
  color: var(--text-btn);
}

.ev-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Explicit template save (shown when A/B/C tab is dirty) */
.ev-tpl-save-wrap {
  margin: .45rem 1rem 0;
  display: flex;
  justify-content: flex-start;
}

.ev-tpl-save-wrap[hidden] {
  display: none;
}

.ev-tpl-save {
  margin: 0;
  padding: .4rem .95rem;
  border: 1.5px solid var(--accent, #2f3d58);
  border-radius: 999px;
  background: transparent;
  color: var(--accent, #2f3d58);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.ev-tpl-save:active {
  transform: scale(0.96);
}

.ev-tpl-save:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ev-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.ev-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ev-field {
  min-width: 0;
}

@media (min-width: 768px) {
  .evContainer {
    max-width: 56rem;
  }

  .ev-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .grid-box {
    margin-top: 1.5rem;
  }
}

#ttlTime {
  flex-direction: column;
  position: absolute;
  right: 0;
  padding: .2rem 1.6rem 0 0;
  font-size: 1rem;
  font-weight: 400;
  text-align: right;
  color: var(--text-muted);
}

.date-wrap {
  margin: .5rem 0 .3rem 0;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.dates-box {
  margin: .4rem 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.dateField {
  width: 11rem;
  padding: .4rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  background-color: var(--bg-input);
  outline: none;
}

.dateField:focus {
  border-color: var(--accent);
}

#stTime,
#etTime {
  width: 8rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: .4rem .7rem;
  font-weight: 600;
  background-color: var(--bg-input);
  outline: none;
}

#stTime:focus,
#etTime:focus {
  border-color: var(--accent);
}

label {
  margin: 0;
  padding: 0;
}

.ev-label {
  display: block;
  margin: .9rem 0 .25rem 1.1rem;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-box {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-width: 0;
}

#eventSubject {
  font-size: 1.1rem;
  border: 1.5px solid var(--border);
  margin: 1.2rem 1rem 0 1rem;
  padding: .7rem 1rem;
  border-radius: 10px;
  width: 100%;
  background-color: var(--bg-input);
  color: var(--text);
  outline: none;
}

#eventSubject:focus {
  border-color: var(--accent);
}

#eventSubject::placeholder {
  color: var(--text-muted);
}

.ddSelect {
  font-size: .9rem;
  padding: .7rem 1rem;
  margin: 0 1rem;
  display: inline-block;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
  width: calc(100% - 2rem);
  background-color: var(--bg-input);
  color: var(--text);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23888888%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9em top 50%;
  background-size: 0.6em auto;
  padding-right: 2.2em;
  outline: none;
  cursor: pointer;
}

.ddSelect:focus {
  border-color: var(--accent);
}

.ddSelect::-ms-expand {
  display: none;
}

/* Searchable combobox — open list first; filter not focused so mobile keyboard stays closed */
.scb {
  position: relative;
  width: calc(100% - 2rem);
  margin: 0 1rem;
}

.scb-btn.ddSelect {
  width: 100%;
  margin: 0;
  text-align: left;
  display: flex;
  align-items: center;
}

.scb-disp {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.scb-disp:empty::before {
  content: '\00a0';
}

.scb-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* Fixed via JS so the open list never extends document height (no page scrollbars / horizontal shift). */
.scb-pan {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-height: min(50vh, 320px);
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
  overflow: hidden;
}

.scb-pan[hidden] {
  display: none !important;
}

.scb-q {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: .65rem .85rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  border-radius: 0;
  /* Prevent iOS zoom on focus */
  font-size: 16px;
}

.scb-q:focus {
  border-bottom-color: var(--accent);
}

.scb-q::placeholder {
  color: var(--text-muted);
}

.scb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.scb-li {
  padding: .6rem .95rem;
  font-size: .88rem;
  line-height: 1.25;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.scb-li:last-child {
  border-bottom: none;
}

.scb-li[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-input));
  font-weight: 600;
}

.scb-li:active {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-input));
}

@media (hover: hover) {
  .scb-li:hover {
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-input));
  }
}

.scb-clear {
  color: var(--text-muted);
}

.scb-empty {
  padding: .65rem .95rem;
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
}

.scb.open .scb-btn {
  border-color: var(--accent);
}

.ddInactive {
  pointer-events: none;
  background-color: var(--bg-inactive) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}

#notesTa {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin: .8rem 1rem 1rem 1rem;
  height: 5.5rem;
  padding: .6rem .9rem;
  width: calc(100% - 2rem);
  max-width: calc(100% - 2rem);
  min-width: 0;
  box-sizing: border-box;
  font-size: 16px;
  background-color: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  outline: none;
  resize: none;
  overflow-wrap: break-word;
  word-break: break-word;
}

#notesTa:focus {
  border-color: var(--accent);
}

.evSaveBtnBox {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: .5rem 0 2rem 0;
}

.evSaveBtnBox button {
  background: var(--bg-btn);
  color: var(--text-btn);
  margin: 0 .4rem;
  padding: .65rem 2rem;
  border-radius: 20px;
  border: 0;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.evSaveBtnBox button:active {
  filter: brightness(0.88);
  transform: scale(0.97);
}

#delBtn {
  background-color: #cc2a2a;
  color: #fff;
  display: none;
}


/* =====================================================
   SETTINGS PAGE
   ===================================================== */

.settings-container {
  padding: 1.2rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.settings-group {
  background: var(--bg-card);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.settings-item {
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item label {
  font-size: .95rem;
  color: var(--text);
  font-weight: 500;
}

.settings-select {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  padding: .5rem .9rem;
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  min-width: 130px;
  outline: none;
  cursor: pointer;
}

.settings-select:focus {
  border-color: var(--accent);
}

.settings-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0;
}

.settings-time-row {
  display: flex;
  gap: 1.5rem;
}

.settings-time-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.settings-sublabel {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.settings-time-input {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  padding: .45rem .7rem;
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  outline: none;
}

.settings-time-input:focus {
  border-color: var(--accent);
}

/*
 * Samsung / Android Chrome paints the native time control slightly wider than
 * the CSS border box (clock glyph + internal padding). Put the border on a
 * shell and clip the control so desktop keeps content-sized inputs.
 */
.settings-time-shell {
  display: inline-block;
  max-width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  overflow: hidden;
  vertical-align: top;
}

.settings-time-shell:focus-within {
  border-color: var(--accent);
}

.settings-time-shell .settings-time-input {
  border: 0;
  border-radius: 0;
  background: transparent;
  /* Keep intrinsic width; do not stretch to fill the card. */
  width: auto;
  max-width: 100%;
  /* Drop right padding that Android adds on top of the clock control. */
  padding-right: .25rem;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.settings-time-shell .settings-time-input:focus {
  border-color: transparent;
}

.settings-time-shell .settings-time-input::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 0;
  /* Pull the clock icon inside the clipped shell. */
  margin-inline-end: 0;
}

/* Theme swatch picker */
.settings-item-column {
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
}

.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  padding: .2rem 0 .3rem 0;
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
}

.swatch-circle {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  transition: transform 0.15s;
}

.swatch:active .swatch-circle {
  transform: scale(0.95);
}

.swatch.active .swatch-circle {
  box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px var(--accent);
}

.swatch-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
}


/* =====================================================
   USERS ADMIN PAGE  (users.html / js/users.js)
   Reuses the settings-* card layout; adds a form + list.
   ===================================================== */

.user-form {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  width: 100%;
}

.user-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.user-field .settings-time-input,
.user-field .settings-select {
  width: 100%;
  box-sizing: border-box;
}

.user-field-check {
  padding-top: .2rem;
}

.user-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text);
}

.user-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.user-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: .2rem;
}

.btn-basic:disabled {
  opacity: .55;
  cursor: default;
}

.user-msg {
  margin: 0;
  font-size: .82rem;
}

.user-msg-error {
  color: #c0392b;
}

.user-msg-ok {
  color: var(--accent);
}

/* Existing-users list */
.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.user-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.user-row-name {
  flex: 1 1 auto;
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row-id {
  color: var(--text-muted);
  font-size: .78rem;
  flex: 0 0 auto;
}

.user-row-tag {
  color: var(--text-muted);
  font-size: .72rem;
  font-style: italic;
  flex: 0 0 auto;
}

.user-del-btn {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: #c0392b;
  border-radius: 8px;
  padding: .3rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.user-del-btn:hover,
.user-del-btn:active {
  background: var(--bg-inactive);
}

.user-list-empty {
  color: var(--text-muted);
  font-size: .85rem;
  padding: .3rem 0;
}

.u-acc {
  display: grid;
  grid-template-columns: 10.2rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

@media (max-width: 860px) {
  .u-acc {
    grid-template-columns: 1fr;
  }
}

.u-cats {
  margin: 0;
  padding: 0.5rem 0.55rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  min-width: 0;
}

.u-cats legend {
  float: left;
  width: 100%;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0;
  margin: 0 0 0.35rem;
}

.u-cats::after {
  content: "";
  display: block;
  clear: both;
}

.u-cat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.15rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.u-cat input {
  margin: 0;
  accent-color: var(--accent);
}

.u-acc-tbl {
  max-height: 52vh;
}

.u-acc-hd {
  cursor: pointer;
  user-select: none;
}

.u-acc-hd:hover {
  text-decoration: underline;
}

.u-foot {
  padding: 0.85rem;
}

.u-foot .pg-row {
  justify-content: center;
}

.swatch.active .swatch-label {
  color: var(--accent);
  font-weight: 700;
}


/* =====================================================
   SEARCH PAGE  (search.html / js/search.js)
   Single constrained column so all controls share one width.
   ===================================================== */

.search-page {
  width: 100%;
  padding: 1rem 1rem 2rem;
  box-sizing: border-box;
}

.search-inner {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  box-sizing: border-box;
}

.search-title {
  margin: .2rem 0 1rem;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  width: 100%;
}

/* From | To on one row, equal width columns.
   minmax(0, 1fr) is required so tracks can shrink below the large
   min-content size of iOS Safari <input type="month">. */
.search-month-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .7rem;
  width: 100%;
  max-width: 100%;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.search-label {
  display: block;
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Shared control width — every input/select is full column width */
.search-control {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: .65rem .85rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
}

/* iOS Safari: native month control has a large intrinsic width and
   ignores max-width unless appearance is reset and min-width is 0. */
.search-month-row input[type="month"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding-left: .55rem;
  padding-right: .55rem;
}

.search-control:focus {
  border-color: var(--accent);
}

/* Custom chevron for selects so padding matches text inputs */
.search-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23888888%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85em top 50%;
  background-size: 0.55em auto;
  padding-right: 2.1em;
  cursor: pointer;
}

.search-select::-ms-expand {
  display: none;
}

.search-select.ddInactive {
  pointer-events: none;
  background-color: var(--bg-inactive) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}

.search-msg {
  margin: 0;
  font-size: .82rem;
  color: var(--text-muted);
}

.search-msg-error {
  color: #c0392b;
}

.search-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: .15rem;
}

.search-count {
  margin: 1.1rem 0 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.search-results {
  list-style: none;
  margin: .35rem 0 0;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.search-empty {
  color: var(--text-muted);
  font-size: .85rem;
  padding: .7rem 0;
  font-style: italic;
  list-style: none;
}

/* Borderless rows — light dividers only */
.search-result-row {
  list-style: none;
  padding: .8rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.search-result-row:last-child {
  border-bottom: none;
}

.search-result-row:active {
  background: color-mix(in srgb, var(--bg-inactive) 70%, transparent);
}

@media (hover: hover) {
  .search-result-row:hover {
    background: color-mix(in srgb, var(--bg-inactive) 55%, transparent);
  }
}

.search-result-main {
  min-width: 0;
}

.search-result-main .evt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
}

.search-result-main .evt-time {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.search-result-main .evt-subject {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.35;
  margin-top: .2rem;
}

.search-result-main .evt-meta {
  font-size: .8rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: .35rem;
}


/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 375px) {

  #prevDayBtn,
  #nextDayBtn {
    width: 3.2rem;
    font-size: .75rem;
  }
}


/* =====================================================
   SIDE NAVIGATION  (js/nav.js)
   Persistent left column on desktop; off-canvas drawer
   behind a top bar on mobile. Themed via the shared vars.
   ===================================================== */

:root {
  --nav-w: 240px;
  --topbar-h: 3.5rem;
}

/* ---- Sidebar column ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  background: var(--bg-nav);
  color: var(--text-nav);
  box-shadow: var(--shadow-nav);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 3000;
  transform: translateX(-100%);        /* off-canvas by default (mobile) */
  transition: transform 0.22s ease;
  /* Bootstrap (event.html) sets body line-height: 1.5; pin normal so
     nav item vertical spacing matches pages that don't load Bootstrap. */
  line-height: normal;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  /* Extra left inset on mobile so the fixed hamburger doesn't overlap the
     brand text when the drawer is open; reset on desktop (no toggle). */
  padding: 1.1rem 1.25rem 1rem 3.6rem;
  border-bottom: 1px solid var(--border);
}

.nav-brand-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-nav);
}

.nav-user {
  font-size: 1rem;
  color: var(--text-muted);
}

.nav-links {
  /* Reset bare `nav {…}` page-header rules so the sidebar column is not clipped. */
  flex: 1 1 auto;
  height: auto;
  overflow-y: auto;
  padding: 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: inherit;
  position: relative;
}

/* Author `display: flex` above would otherwise override the hidden attribute. */
.nav-links[hidden] {
  display: none;
}

.nav-div {
  height: 1px;
  background: var(--border);
  margin: 0.45rem 0.4rem;
  flex: 0 0 auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-nav);
  font-size: 1rem;
  line-height: normal;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link:active {
  background: var(--bg-card);
}

.nav-link.active {
  background: var(--bg-btn);
  color: var(--text-btn);
  font-weight: 600;
}

.nav-icon {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-footer {
  padding: 0.6rem 0.6rem 1rem;
  border-top: 1px solid var(--border);
}

.nav-signout {
  color: var(--text-muted);
}

/* ---- Mobile top bar + hamburger toggle ---- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-nav);
  color: var(--text-nav);
  box-shadow: var(--shadow-nav);
  display: flex;
  align-items: center;
  padding-left: 3.6rem;               /* room for the toggle button */
  font-size: 1.15rem;
  font-weight: 500;
  z-index: 2000;
}

.topbar-title {
  color: var(--text-nav);
}

.nav-toggle {
  position: fixed;
  top: 0;
  left: 0;
  height: var(--topbar-h);
  width: 3.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--text-nav);
  cursor: pointer;
  padding: 0;
  z-index: 3100;
}

.nav-toggle svg {
  width: 1.6rem;
  height: 1.6rem;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2900;
  opacity: 0;
  transition: opacity 0.22s ease;
}

/* ---- Open state (mobile drawer) ---- */
body.nav-open .sidebar {
  transform: translateX(0);
}

body.nav-open .nav-backdrop {
  opacity: 1;
}

/* Push page content clear of the fixed top bar on mobile. Only pages that
   load nav.js get the .has-sidebar class, so the login and other sidebar-less
   pages keep their original layout. */
body.has-sidebar {
  padding-top: var(--topbar-h);
}

/* ---- Desktop: persistent column, no top bar ---- */
@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);
  }

  .topbar,
  .nav-toggle {
    display: none;
  }

  .nav-backdrop {
    display: none;
  }

  .nav-brand {
    padding-left: 1.25rem;
  }

  body.has-sidebar {
    padding-top: 0;
    padding-left: var(--nav-w);
  }
}

/* =====================================================
   EVENT PAGE + SIDE NAV
   Keeps the Timecard bar (back + hours). nav.js skips the
   generic topbar on body.ev-page; hamburger sits on this bar.
   ===================================================== */

/* Event uses its own bar instead of .topbar; don't reserve topbar space. */
body.has-sidebar.ev-page {
  padding-top: 0;
}

/* Safety: hide injected topbar if present (ev-page skips it in nav.js). */
body.ev-page .topbar {
  display: none;
}

/* Hamburger sits over the event bar (keep z above sidebar so it stays tappable when open). */
body.ev-page .nav-toggle {
  height: 4rem;
  width: 3.2rem;
  z-index: 3100;
  color: var(--text);
}

/* Room for hamburger on the left; back arrow stays after it.
   No nav chrome — flat against page bg (not --bg-nav / shadow). */
body.ev-page .ev-topnav {
  padding-left: 3.2rem;
  position: sticky;
  top: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  margin-bottom: 0.75rem;
}

body.ev-page .ev-topnav #navbar-order {
  color: var(--text);
}

body.ev-page .ev-topnav .arrow,
body.ev-page .ev-topnav .arrow::after,
body.ev-page .ev-topnav .arrow::before {
  background-color: var(--text);
}

body.ev-page .nav-backdrop[hidden] {
  display: none;
}

@media (min-width: 768px) {
  body.ev-page .nav-toggle {
    display: none;
  }

  body.ev-page .ev-topnav {
    padding-left: 0.6em;
  }
}


/* =====================================================
   ADMIN / WINDOWS-CLIENT PAGES
   ===================================================== */

.pg {
  padding: 1rem;
  max-width: 1400px;
}

.pg-wide {
  max-width: none;
}

.pg h1,
.pg-h {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.pg-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.8rem;
}

.pg-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.pg-fld {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 8rem;
}

.pg-fld[hidden] {
  display: none !important;
}

.pg-fld label,
.pg-lab {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pg input[type="text"],
.pg input[type="number"],
.pg input[type="date"],
.pg input[type="time"],
.pg input[type="password"],
.pg input[type="color"],
.pg select,
.pg textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.95rem;
}

.pg textarea {
  min-height: 6rem;
  resize: vertical;
}

.pg input:focus,
.pg select:focus,
.pg textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pg-chk {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.pg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.pg-msg {
  font-size: 0.9rem;
  margin: 0.4rem 0;
}

.pg-err {
  color: #c02828;
}

.pg-ok {
  color: #1a7a3a;
}

body.theme-dark .pg-err {
  color: #ff8a8a;
}

body.theme-dark .pg-ok {
  color: #7dcc90;
}

@media (prefers-color-scheme: dark) {
  body.theme-system .pg-err {
    color: #ff8a8a;
  }
  body.theme-system .pg-ok {
    color: #7dcc90;
  }
}

.pg-split {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr);
  gap: 0.85rem;
  align-items: start;
}

.pg-split-3 {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) minmax(220px, 0.9fr);
  gap: 0.85rem;
  align-items: start;
}

@media (max-width: 860px) {
  .pg-split,
  .pg-split-3 {
    grid-template-columns: 1fr;
  }
}

.pg-card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0.85rem;
  min-width: 0;
}

.pg-card h2 {
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
}

.pg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 70vh;
  overflow: auto;
}

.pg-li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.pg-li:hover {
  background: var(--bg-input);
}

.pg-li.on {
  background: var(--bg-btn);
  color: var(--text-btn);
  font-weight: 600;
}

.pg-li-id {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.82rem;
  min-width: 4.2rem;
}

.pg-li.on .pg-li-id {
  color: inherit;
  opacity: 0.8;
}

.pg-form {
  display: grid;
  gap: 0.65rem;
}

.pg-form .pg-fld {
  min-width: 0;
}

.pg-form .pg-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pg-form .pg-card h2 {
  margin-bottom: 0;
}

.pg-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 560px) {
  .pg-2col {
    grid-template-columns: 1fr;
  }
}

.pg-tbl-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  max-height: 68vh;
}

.pg-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.pg-tbl th,
.pg-tbl td {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  text-align: left;
}

.pg-tbl th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  font-weight: 600;
}

.pg-tbl tr.on td {
  background: var(--bg-btn);
  color: var(--text-btn);
}

.pg-tbl tbody tr {
  cursor: pointer;
}

.pg-tbl input,
.pg-tbl select {
  width: 100%;
  min-width: 4.5rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.3rem;
  font: inherit;
  font-size: 0.82rem;
}

.pg-tbl input[type="checkbox"] {
  width: auto;
  min-width: 0;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-danger {
  background: #c02828;
  color: #fff;
  border: 0;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-basic:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-g {
  font-weight: 600;
  padding: 0.35rem 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tree-i {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.tree-i:hover {
  background: var(--bg-input);
}

.tree-i.on {
  background: var(--bg-btn);
  color: var(--text-btn);
  font-weight: 600;
}

.rpt-out {
  overflow: auto;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  min-height: 12rem;
}

.rpt-out table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.rpt-out th,
.rpt-out td {
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0.4rem;
  text-align: left;
}

@media print {
  .sidebar, .topbar, .nav-toggle, .nav-backdrop, .pg-bar, .no-print {
    display: none !important;
  }
  body.has-sidebar {
    padding: 0 !important;
  }
}