/* Civic Bridge — brand system per "Civic Bridge Brand Theme" (Civic Bridge shared drive) */
:root {
  --navy: #17164F;
  --purple: #5A32C9;
  --magenta: #C23B92;
  --orange: #FF792E;
  --gold: #FFA329;
  --white: #FFFFFF;
  --soft-gray: #F5F5F7;
  --slate: #626575;
  --line: #E6E6EE;
  --gradient: linear-gradient(90deg, #5132C9 0%, #B63C9A 50%, #FF792E 100%);
  --radius: 14px;
  --shadow: 0 18px 50px -28px rgba(23, 22, 79, 0.35);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--soft-gray); color: var(--navy);
  font-family: "Inter", "Avenir Next", "Montserrat", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--purple); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--purple);
}
.label.orange { color: var(--orange); }
.label.slate { color: var(--slate); }

/* Top bar */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; display: block; height: 3px; background: var(--gradient); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-weight: 800; }
.brand img { height: 30px; width: auto; }
.brand span { font-size: 13px; font-weight: 600; color: var(--slate); border-left: 1px solid var(--line); padding-left: 10px; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--navy); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.nav a.active, .nav a:hover { background: var(--soft-gray); }
.nav .who { font-size: 13px; color: var(--slate); margin-left: 8px; }

.page { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }
.page.narrow { max-width: 860px; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  text-decoration: none; transition: transform .05s, background .15s, box-shadow .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: var(--white); box-shadow: 0 8px 20px -10px rgba(255, 121, 46, .8); }
.btn-primary:hover { background: #F06A1F; }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn-danger { background: var(--white); color: #B42318; border-color: #F3D0CC; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--navy); }
input[type=text], input[type=email], input[type=password], select, textarea {
  font: inherit; font-size: 15px; color: var(--navy); background: var(--white); border: 1px solid #D9D9E3;
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(90, 50, 201, .25); border-color: var(--purple); }
textarea { min-height: 70px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  cursor: pointer; background: var(--white); user-select: none;
}
.check:has(input:checked) { border-color: var(--purple); background: #F4F0FD; }
.check input { accent-color: var(--purple); width: 16px; height: 16px; }
.error { color: #B42318; font-size: 14px; font-weight: 600; }

/* Pills / chips */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--soft-gray); color: var(--slate); }
.pill.ok { background: #E7F6EE; color: #11753F; }
.pill.demo { background: #FFF3E3; color: #9A5A00; }
.pill.bad { background: #FDECEA; color: #B42318; }
.pill.purple { background: #EFE9FC; color: var(--purple); }
.pill.orange { background: #FFEDE2; color: #C2520F; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Mini month calendar (date picker) */
.months { display: flex; gap: 24px; flex-wrap: wrap; }
.month { min-width: 250px; }
.month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.month-grid .dow { font-size: 11px; font-weight: 700; color: var(--slate); text-align: center; padding: 4px 0; }
.month-grid button {
  font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--navy); border-radius: 8px; aspect-ratio: 1; cursor: pointer;
}
.month-grid button:hover { background: var(--soft-gray); }
.month-grid button.sel { background: var(--purple); color: var(--white); font-weight: 700; }
.month-grid button.past { color: #C2C3CC; cursor: not-allowed; }
.month-grid button.today { box-shadow: inset 0 0 0 1.5px var(--orange); }

/* Slot grid */
.sg-scroll { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.sg { display: grid; user-select: none; -webkit-user-select: none; min-width: max-content; }
.sg-corner, .sg-head { position: sticky; top: 0; z-index: 3; background: var(--white); border-bottom: 1px solid var(--line); }
.sg-corner { left: 0; z-index: 4; }
.sg-head { text-align: center; padding: 10px 4px 8px; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.sg-wd { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); }
.sg-dt { font-size: 16px; font-weight: 800; color: var(--navy); }
.sg-time { position: sticky; left: 0; z-index: 2; background: var(--white); font-size: 11px; color: var(--slate); text-align: right; padding: 2px 8px 0 0; line-height: 1; height: 22px; border-top: 1px solid transparent; }
.sg-time.sg-hour { border-top-color: var(--line); }
.sg-cell {
  height: 22px; border-left: 1px solid var(--line); border-top: 1px dashed #EFEFF4; cursor: pointer; touch-action: none;
  position: relative; font-size: 10px; font-weight: 700; color: var(--white); display: flex; align-items: center; justify-content: center;
}
.sg-cell.sg-hour { border-top: 1px solid var(--line); }
.sg-readonly .sg-cell { cursor: default; }
.sg-cell:hover { outline: 2px solid rgba(255, 121, 46, .7); outline-offset: -2px; z-index: 1; }
.sg-cell.unavail {
  cursor: not-allowed; background: repeating-linear-gradient(135deg, #F1F1F5 0 6px, #E7E7EE 6px 12px);
}
.sg-cell.blocked { background: repeating-linear-gradient(135deg, #2B2A63 0 6px, #17164F 6px 12px); cursor: pointer; }
.sg-cell.busy { background: repeating-linear-gradient(135deg, #F4F1FB 0 6px, #E6E0F5 6px 12px); color: var(--slate); }
.sg-cell.mine { background: var(--purple); }
.sg-cell.mine.others::after { content: ""; position: absolute; right: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--gold); }
.sg-cell.final { background: var(--orange) !important; }
.sg-cell.text-navy { color: var(--navy); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--slate); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; border: 1px solid var(--line); }

.tabs { display: inline-flex; background: var(--soft-gray); border-radius: 10px; padding: 3px; }
.tabs button { font: inherit; font-size: 14px; font-weight: 700; border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; color: var(--slate); cursor: pointer; }
.tabs button.on { background: var(--white); color: var(--navy); box-shadow: 0 1px 3px rgba(23, 22, 79, .12); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }
.side { position: sticky; top: 90px; }
.hoverbox { min-height: 120px; }
.namelist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.namelist li { display: flex; align-items: center; gap: 8px; }
.namelist .x { color: #C2C3CC; text-decoration: line-through; }

.best { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.best li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.best .when { font-weight: 700; font-size: 14px; }
.best .who { font-size: 12px; color: var(--slate); }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--soft-gray); border-radius: 10px; padding: 6px 6px 6px 12px; }
.linkbox code { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); }

.banner { border-radius: var(--radius); padding: 18px 22px; background: var(--navy); color: var(--white); position: relative; overflow: hidden; }
.banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--gradient); }
.banner .label { color: var(--gold); }
.banner.info { background: #FFF6EC; color: var(--navy); border: 1px solid #FFE0BF; }
.banner.info .label { color: #C2520F; }

.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.event-card { display: flex; flex-direction: column; gap: 10px; }
.event-card h3 { font-size: 17px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.simple td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }

.hero { text-align: center; padding: 20px 0 8px; }
.hero h1 { margin-top: 6px; }
.gradient-rule { height: 3px; width: 72px; background: var(--gradient); border-radius: 3px; margin: 14px auto; }

.login { max-width: 420px; margin: 8vh auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--navy); color: var(--white); padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; padding: 40px 20px; color: var(--slate); }
.hidden { display: none !important; }
