/* ClearFuze Billing App: Billing Hub look.
   Navy header #0F4B8F, gold accent #FFC233, Montserrat body, Jost headings and numerals,
   3-4px corners, ruled tables, light and dark mode. */

:root {
  --navy: #0f4b8f;
  --navy-deep: #0b3a6f;
  --gold: #ffc233;
  --gold-deep: #e0a400;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5b6676;
  --rule: #d9dee6;
  --rule-strong: #b8c0cc;
  --row-alt: #f9fafc;
  --link: #0f4b8f;
  --button-fg: #0f4b8f;
  --danger: #b3261e;
  --ok: #1e7b34;
  --danger-bg: #fdecea;
  --focus: #ffc233;

  --radius: 3px;
  --radius-lg: 4px;
  --font-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Jost', 'Futura', 'Montserrat', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1520;
    --surface: #152030;
    --text: #e6ebf2;
    --muted: #9aa7b8;
    --rule: #2a3a50;
    --rule-strong: #3a4d66;
    --row-alt: #182536;
    --link: #8fbaf0;
    --button-fg: #8fbaf0;
    --danger: #ff8a80;
    --ok: #7bd88f;
    --danger-bg: #3a1d1d;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0e1520;
  --surface: #152030;
  --text: #e6ebf2;
  --muted: #9aa7b8;
  --rule: #2a3a50;
  --rule-strong: #3a4d66;
  --row-alt: #182536;
  --link: #8fbaf0;
  --button-fg: #8fbaf0;
  --danger: #ff8a80;
  --ok: #7bd88f;
  --danger-bg: #3a1d1d;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}
h1 {
  font-size: 1.75rem;
}
h2 {
  font-size: 1.25rem;
}

a {
  color: var(--link);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.num,
td.num {
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Header */
.site-header {
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.6rem 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 1.2rem;
}
.brand-mark {
  width: 14px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}
.brand-name {
  font-weight: 700;
}
.brand-sub {
  font-weight: 400;
  opacity: 0.85;
}
.spacer {
  flex: 1;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem;
  flex: 1;
}
.main-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover {
  background: var(--navy-deep);
}
.main-nav a.active {
  border-bottom-color: var(--gold);
  background: var(--navy-deep);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.user-name {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-badge {
  background: var(--gold);
  color: #1b2430;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.theme-toggle,
.link-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.25rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
}
.theme-toggle:hover,
.link-button:hover {
  border-color: var(--gold);
}
form.inline {
  display: inline;
  margin: 0;
}

.dev-banner {
  background: var(--gold);
  color: #1b2430;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.2rem 16px;
}

/* Content */
.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 16px 3rem;
}
.content.narrow {
  max-width: 560px;
}
.page-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.lede {
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: 60rem;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.25rem;
}
.tag {
  display: inline-block;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.error-panel {
  border-top: 4px solid var(--danger);
}
.dev-login {
  border-top: 4px solid var(--gold);
}

/* Buttons */
.button {
  display: inline-block;
  background: var(--surface);
  color: var(--button-fg);
  border: 1px solid var(--button-fg);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button.primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.button.primary:hover {
  background: var(--navy-deep);
}

fieldset {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
}
legend {
  font-weight: 600;
  padding: 0 0.25rem;
}
label.radio {
  display: block;
  padding: 0.2rem 0;
  cursor: pointer;
}

/* Start page cards */
.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.card:hover {
  border-color: var(--navy);
  border-left-color: var(--gold);
}

/* Ruled tables */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
table.ruled {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.ruled th {
  text-align: left;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 2px solid var(--rule-strong);
  padding: 0.6rem 0.75rem;
  white-space: nowrap;
}
table.ruled td {
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0.75rem;
}
table.ruled tbody tr:nth-child(even) td,
table.ruled tbody tr:nth-child(even) th {
  background: var(--row-alt);
}
table.ruled td.empty {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
}

@media (max-width: 720px) {
  .header-inner {
    gap: 0.5rem;
  }
  .main-nav {
    order: 3;
    flex-basis: 100%;
  }
  .user-name {
    display: none;
  }
  .header-inner {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* Check lists (e.g. Autotask connection) */
.checks {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.checks li {
  display: flex;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.checks li:last-child {
  border-bottom: none;
}
.checks .status {
  flex: 0 0 4.5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.checks li.ok .status {
  color: var(--ok);
}
.checks li.fail .status {
  color: var(--danger);
}
.checks .detail {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}
.checks .detail table {
  margin-top: 0.5rem;
}
table.ruled.compact td,
table.ruled.compact th {
  padding: 0.35rem 0.6rem;
}
.bad {
  color: var(--danger);
  font-weight: 600;
}

/* Rosters */
.picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.picker-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0;
}
.picker label {
  font-weight: 600;
}
.picker select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  min-width: min(100%, 22rem);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.button.small {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}
.small {
  font-size: 0.8rem;
}
.flash {
  flex-basis: 100%;
  border-left: 4px solid var(--gold);
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  margin: 0 0 0.5rem;
}
.bad-panel {
  border-left: 4px solid var(--danger);
  background: var(--danger-bg);
  padding: 0.6rem 0.8rem;
}
#roster h2 {
  margin-top: 1.25rem;
}
.section-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-head .count {
  font-family: var(--font-head);
  color: var(--text);
  margin-left: 0.25rem;
}
.seats-slot {
  min-height: 3rem;
}
table.seats th[scope='row'] {
  text-align: left;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
}
table.seats .sub {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}
table.seats td.strong {
  font-weight: 700;
}
table.seats tr.mismatch th[scope='row'] {
  box-shadow: inset 4px 0 0 var(--gold);
}
table.seats tfoot th,
table.seats tfoot td {
  border-top: 2px solid var(--rule-strong);
  border-bottom: none;
  font-weight: 700;
}
table.ruled th.num {
  text-align: right;
}
.nowrap {
  white-space: nowrap;
}
table.roster td.name {
  min-width: 9rem;
}
table.roster td.name summary {
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
table.roster tr.status-departed td,
table.roster tr.status-cancelled td {
  color: var(--muted);
}
dl.mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1rem;
  margin: 0.5rem 0 0.25rem;
  min-width: 13rem;
  max-width: 20rem;
  font-size: 0.8rem;
}
dl.mini dt {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
dl.mini dd {
  margin: 0;
}
.pill {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--rule-strong);
}
.pill.active {
  border-color: var(--ok);
  color: var(--ok);
}
.pill.pending {
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}
.loading {
  font-style: italic;
}

/* Roster upload */
.crumbs {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}
.upload-form input[type='file'] {
  display: block;
  margin: 0.5rem 0 0.25rem;
  font: inherit;
}
ul.tight {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.stat .n {
  display: block;
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
}
.stat.ok {
  border-top-color: var(--ok);
}
.stat.warn {
  border-top-color: var(--gold);
}
.stat.bad {
  border-top-color: var(--danger);
}
.load-panel {
  border-top: 4px solid var(--gold);
}
ul.issues {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.8rem;
}
ul.issues li.bad {
  color: var(--danger);
  font-weight: 600;
}
table.import-rows td {
  vertical-align: top;
}
.content h2 {
  margin-top: 1.75rem;
}
.content .panel h2,
.content #roster .section-head h2 {
  margin-top: 0.25rem;
}

/* Requests and queue */
.badge {
  display: inline-block;
  min-width: 1.3em;
  padding: 0 0.35em;
  margin-left: 0.15rem;
  border-radius: 999px;
  background: var(--gold);
  color: #1b2430;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}
.request-form {
  max-width: 980px;
}
.request-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
}
.request-form .field > span {
  font-weight: 600;
  font-size: 0.875rem;
}
.request-form input[type='text'],
.request-form input[type='email'],
.request-form input[type='date'],
.request-form input[type='month'],
.request-form select,
.request-form textarea,
.period-form input[type='month'] {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.period-form input[type='month'] {
  width: auto;
}
.req {
  font-style: normal;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--danger);
}
.grid2,
.grid3 {
  display: grid;
  gap: 0 1rem;
}
@media (min-width: 720px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.type-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.inline-radio {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}
.preview {
  margin: 1.6rem 0 0.25rem;
  border-left: 4px solid var(--gold);
  padding-left: 0.6rem;
}
details.optional {
  margin-bottom: 0.9rem;
}
details.optional summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
ol.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
ol.steps li {
  display: flex;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--rule);
}
ol.steps li:last-child {
  border-bottom: none;
}
ol.steps .mark {
  flex: 0 0 1.5rem;
  font-weight: 700;
  font-family: var(--font-head);
  font-size: 1.1rem;
}
ol.steps li.succeeded .mark {
  color: var(--ok);
}
ol.steps li.failed .mark,
ol.steps .bad {
  color: var(--danger);
}
ol.steps li.waiting .mark,
ol.steps li.skipped .mark {
  color: var(--muted);
}
ol.steps strong {
  display: block;
}
table.facts th[scope='row'] {
  width: 12rem;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.875rem;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.pill.submitted,
.pill.processing {
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}
.pill.failed {
  border-color: var(--danger);
  color: var(--danger);
}
.pill.completed {
  border-color: var(--ok);
  color: var(--ok);
}
.period {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  border-top: 4px solid var(--navy);
}
.period.warn {
  border-top-color: var(--danger);
}
.period-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
table .sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
h2 .count {
  font-size: 0.9rem;
  color: var(--muted);
  margin-left: 0.3rem;
}
