/* FinSpec brand palette and font, from the finspec-branding skill (brand_common.py).
   Stage accent colours (teal, blue, purple, deep green, slate) are provisional, to be ratified. */
:root {
  --green: #A8C84A;        /* primary green */
  --green-dark: #95B341;   /* dark green */
  --green-mid: #BED86C;
  --green-light: #CFE18B;
  --green-pale: #ECF0E3;   /* web and slides only */
  --grey-text: #4D5052;    /* dark grey */
  --grey-border: #B9BEC4;
  --off-white: #F9F9F8;    /* web and slides only */
  --white: #FFFFFF;
  --red: #C0533C;
  --red-pale: #FBEAE6;
  --amber: #B8860B;
  --amber-pale: #FBF3DC;
  --font: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--grey-text); background: var(--off-white); font-size: 16px; line-height: 1.45; }
[hidden] { display: none !important; }
h1, h2, h3 { color: var(--grey-text); font-weight: 700; margin: 0 0 .5rem; }
h2 { font-size: 1.6rem; padding-bottom: .35rem; border-bottom: 3px solid var(--green); display: inline-block; }
.muted { color: #6c7073; }

.banner { background: var(--grey-text); color: var(--white); text-align: center; font-size: .85rem; padding: .3rem 1rem; letter-spacing: .02em; }

/* Sign-in */
.sign-in { display: flex; justify-content: center; padding: 3rem 1rem; }
.sign-in-card { background: var(--white); border: 1px solid var(--grey-border); border-top: 6px solid var(--green); border-radius: 6px; padding: 2rem; width: 100%; max-width: 560px; }
.sign-in-logo { width: 200px; height: auto; display: block; margin-bottom: 1rem; }
.app-name { font-size: 1.5rem; }
.user-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.user-button { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--off-white); border: 1px solid var(--grey-border); border-radius: 4px; padding: .7rem .9rem; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; }
.user-button:hover, .user-button:focus-visible { border-color: var(--green-dark); background: var(--green-pale); outline: none; }

/* Shell: left module bar + main */
.shell { display: flex; min-height: calc(100vh - 1.8rem); }
.sidebar { width: 200px; flex-shrink: 0; background: var(--white); border-right: 1px solid var(--grey-border); display: flex; flex-direction: column; }
.sidebar-brand { padding: 1rem 1rem .75rem; border-bottom: 4px solid var(--green); }
.sidebar-brand img { width: 140px; height: auto; display: block; }
.modules { display: flex; flex-direction: column; padding: .5rem 0; }
.module { display: flex; align-items: center; gap: .65rem; font: inherit; color: var(--grey-text); background: none; border: none; border-left: 4px solid transparent; padding: .45rem .9rem; cursor: pointer; text-align: left; }
.module:hover { background: var(--off-white); }
.module[aria-current="page"] { background: var(--green-pale); border-left-color: var(--accent, var(--green-dark)); font-weight: 700; }
.module .icon { width: 30px; height: 30px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent, var(--grey-text)); color: var(--white); flex-shrink: 0; }
.module .icon svg { width: 18px; height: 18px; }
.module .count { margin-left: auto; font-size: .78rem; background: var(--red); color: var(--white); border-radius: 999px; padding: 0 .45rem; font-weight: 700; }
.module.soon { opacity: .6; }
.module-heading { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #8a8e91; padding: .9rem 1rem .25rem; }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--white); border-bottom: 1px solid var(--grey-border); padding: .7rem 1.5rem; }
.topbar-name { font-size: 1.15rem; font-weight: 700; }
.whoami { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.roles { display: inline-flex; gap: .3rem; }
.role { background: var(--green-pale); border: 1px solid var(--green-mid); border-radius: 999px; padding: 0 .55rem; font-size: .8rem; }
.link-button { font: inherit; background: none; border: none; color: var(--green-dark); text-decoration: underline; cursor: pointer; padding: 0; }
.view { padding: 1.5rem; max-width: 1300px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .75rem 0; }
.segmented { display: inline-flex; border: 1px solid var(--grey-border); border-radius: 6px; overflow: hidden; }
.segmented button { font: inherit; background: var(--white); color: var(--grey-text); border: none; padding: .35rem .9rem; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--grey-border); }
.segmented button[aria-pressed="true"] { background: var(--green); font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; padding: .15rem .3rem .15rem .7rem; color: var(--white); font-size: .9rem; }
.chip button { font: inherit; background: rgba(255,255,255,.25); color: var(--white); border: none; border-radius: 999px; width: 1.4rem; height: 1.4rem; cursor: pointer; line-height: 1; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--grey-border); }
th { text-align: left; background: var(--green-pale); border-bottom: 2px solid var(--green); padding: .55rem .7rem; font-weight: 700; white-space: nowrap; }
td { border-top: 1px solid var(--grey-border); padding: .55rem .7rem; vertical-align: middle; }
tr.alert-red td:first-child { box-shadow: inset 5px 0 0 var(--red); }
tr.alert-amber td:first-child { box-shadow: inset 5px 0 0 var(--amber); }
.client-name { font-weight: 700; }
.sub { font-size: .82rem; color: #6c7073; }
.stage-badge { display: inline-flex; align-items: center; gap: .35rem; border-radius: 4px; padding: .1rem .55rem; color: var(--white); font-size: .88rem; font-weight: 700; white-space: nowrap; }
.stage-badge svg { width: 14px; height: 14px; }
.alert { display: inline-flex; align-items: center; gap: .35rem; border-radius: 4px; padding: .1rem .55rem; font-size: .88rem; white-space: nowrap; border: 1px solid transparent; }
.alert svg { width: 14px; height: 14px; }
.alert.red { background: var(--red-pale); color: var(--red); border-color: var(--red); font-weight: 700; }
.alert.amber { background: var(--amber-pale); color: var(--amber); border-color: var(--amber); font-weight: 700; }
.alert.ok { color: var(--green-dark); }
.tag { display: inline-block; font-size: .78rem; border-radius: 3px; padding: 0 .4rem; border: 1px solid var(--grey-border); background: var(--off-white); }
.tag.ok { border-color: var(--green-dark); background: var(--green-pale); }
.tag.warn { border-color: var(--amber); background: var(--amber-pale); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .82rem; }

.button { font: inherit; background: var(--green); color: var(--grey-text); border: 1px solid var(--green-dark); border-radius: 4px; padding: .3rem .8rem; cursor: pointer; font-weight: 700; }
.button:hover { background: var(--green-dark); color: var(--white); }
.button.secondary { background: var(--white); border-color: var(--grey-border); font-weight: 400; }
.button.secondary:hover { background: var(--off-white); color: var(--grey-text); }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.error { margin: 1rem 1.5rem 0; background: #fff4f2; border: 1px solid #d9826f; border-left: 6px solid var(--red); padding: .7rem 1rem; border-radius: 4px; }
.error code { font-size: .85rem; }
.notice { background: var(--white); border: 1px solid var(--grey-border); border-left: 6px solid var(--green); padding: .8rem 1rem; border-radius: 4px; margin-top: .75rem; }
.placeholder-note { font-size: .85rem; color: #6c7073; margin-top: .75rem; }

/* Client detail */
.client-link { font: inherit; font-weight: 700; color: var(--grey-text); background: none; border: none; padding: 0; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px; }
.client-link:hover { color: var(--green-dark); }
.back { display: block; margin-bottom: .75rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; margin: .5rem 0 1rem; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.card { background: var(--white); border: 1px solid var(--grey-border); border-radius: 6px; padding: 1rem 1.25rem; }
.card h3 { font-size: 1.1rem; margin-bottom: .75rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.facts dt { color: #6c7073; }
.facts dd { margin: 0; }
.ok-notice { border-left-color: var(--green-dark); }
.warn-notice { border-left-color: var(--amber); background: var(--amber-pale); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.tile { border: 1px solid var(--grey-border); border-top: 4px solid var(--accent); border-radius: 6px; padding: .75rem; background: var(--off-white); }
.tile.current { background: var(--white); box-shadow: 0 0 0 2px var(--accent) inset; }
.tile-icon { display: inline-flex; width: 30px; height: 30px; border-radius: 7px; align-items: center; justify-content: center; color: var(--white); background: var(--accent); }
.tile-icon svg { width: 18px; height: 18px; }
.tile-label { font-weight: 700; margin-top: .4rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.timeline li { display: flex; gap: .7rem; align-items: flex-start; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: .35rem; flex-shrink: 0; }
.table-wrap { overflow-x: auto; }
td, th { white-space: nowrap; }
td .client-link, td .sub { white-space: nowrap; }

/* Time alerts */
.num { width: 6rem; font: inherit; padding: .25rem .4rem; border: 1px solid var(--grey-border); border-radius: 4px; }
.soa-card .button { margin: .25rem 0 .75rem; }
.data-card h4 { font-size: 1rem; margin: 1rem 0 .4rem; }
.data-card td.num, .data-card th.num { text-align: right; white-space: nowrap; }
.data-card .notes { width: 100%; font: inherit; padding: .4rem; border: 1px solid var(--grey-border); border-radius: 4px; margin-bottom: .5rem; }
.data-card .input { font: inherit; padding: .2rem .4rem; border: 1px solid var(--grey-border); border-radius: 4px; }
.data-card .edit-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.data-card .history { list-style: none; padding: 0; margin: .5rem 0 0; }
.data-card .history li { padding: .35rem 0; border-top: 1px solid var(--grey-border); }
.data-card details { margin-top: .75rem; }
.data-card .button:disabled { opacity: .6; cursor: default; }
