/* AMS-OS product surface: component shapes only.
 *
 * The palette, the type families and every contrast-safe pair now live in
 * tokens.css, which loads first. This file styles components and must not
 * declare a raw colour: if a component needs a new one, it gets a token.
 *
 * Component shapes are still lifted from the demo at
 * chofski/clients/thirst-craft/system-demo.html, which is the design target
 * under P8. Task 433ffe9b settled the token layer on 24 August 2026; the
 * demoted ams-os-design-tokens.md is superseded by tokens.css and its header
 * records what was taken from where, and what was deliberately left behind.
 */

* { box-sizing: border-box; margin: 0 }
html, body { height: 100% }
body {
    font-family: var(--font-body);
    background: var(--offwhite);
    color: var(--charcoal);
    display: flex;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer }
a { color: var(--teal) }

/* ---------- shell ---------- */
#sidebar {
    width: 216px; min-width: 216px; background: var(--ink); color: var(--offwhite);
    display: flex; flex-direction: column; padding: 20px 0;
}
#logo {
    padding: 0 20px 22px; border-bottom: 1px solid rgba(247, 244, 240, .12);
    margin-bottom: 14px; background: none; border-left: 0; border-right: 0; border-top: 0;
    text-align: left; width: 100%; color: inherit;
}
#logo .eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .1em; color: var(--sage) }
#logo h1 { font-size: 19px; font-weight: 600; letter-spacing: .01em; margin-top: 2px }
.navitem {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: none;
    border: 0; color: rgba(247, 244, 240, .78); width: 100%; text-align: left;
    font-size: 14px; border-left: 3px solid transparent;
}
.navitem:hover { color: var(--offwhite); background: rgba(247, 244, 240, .05) }
.navitem.active { color: var(--offwhite); border-left-color: var(--sage); background: rgba(163, 185, 163, .12); font-weight: 600 }
.navitem svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8 }
#sidebar .spacer { flex: 1 }
.navsection {
    font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
    color: var(--sage); padding: 18px 20px 6px; opacity: .8;
}
#whoami { padding: 14px 20px; border-top: 1px solid rgba(247, 244, 240, .12); font-size: 12.5px }
#whoami .nm { font-weight: 600; color: var(--offwhite) }
#whoami .em { color: rgba(247, 244, 240, .6); margin-top: 2px; overflow-wrap: anywhere }
#whoami button {
    margin-top: 10px; background: none; border: 1px solid rgba(247, 244, 240, .3);
    color: rgba(247, 244, 240, .85); border-radius: 999px; padding: 6px 14px; font-size: 12.5px;
}
#whoami button:hover { border-color: var(--sage); color: var(--offwhite) }

#main { flex: 1; overflow: auto; display: flex; flex-direction: column; min-width: 0 }
.topbar { display: flex; align-items: baseline; gap: 16px; padding: 22px 28px 14px; flex-wrap: wrap }
.topbar h2 { font-size: 22px; font-weight: 600 }
.topbar .sub { color: var(--darksage); font-size: 13px }
.topbar .controls { margin-left: auto; display: flex; gap: 8px; align-items: center }

.pill { border: 1px solid var(--putty); background: var(--white); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; color: var(--charcoal) }
.pill:hover:not(:disabled) { background: var(--offwhite) }
.pill:disabled { opacity: .45; cursor: not-allowed }
.pill.primary { background: var(--fill-action); border-color: var(--fill-action); color: var(--on-fill-action); font-weight: 600 }
.pill.primary:hover:not(:disabled) { background: var(--fill-action-hover); border-color: var(--fill-action-hover) }
select.pill { font: inherit; font-size: 12.5px; cursor: pointer; max-width: 200px }
input.pill, textarea.pill { font: inherit; font-size: 12.5px; width: 100% }

/* A destructive action is not a primary one. It stays quiet until hovered,
 * because the fastest way to make someone click Delete by accident is to
 * make it the brightest thing on the row. */
.pill.warn { color: var(--error); border-color: var(--putty) }
.pill.warn:hover:not(:disabled) { border-color: var(--error); background: rgba(184, 83, 58, .06) }

/* The two ways onto an empty card, and the same pair repeated under a
 * populated one so the second role is no harder to add than the first. */
.emptyacts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap }
.addbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0 2px }
.addbar .grow { flex: 1 }

/* Remove sits in the row rather than in a toolbar, because it acts on that
 * row and nothing else. Understated on purpose: see .pill.warn above. */
td.rowact { text-align: right; width: 1%; white-space: nowrap }
.linkbtn {
    background: none; border: 0; padding: 4px 2px; font: inherit; font-size: 12.5px;
    color: var(--darksage); text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--error) }

textarea.pill { min-height: 120px; resize: vertical; line-height: 1.5; font-size: 13px }

/* ---------- tables ---------- */
.tablewrap { padding: 0 28px 28px; overflow: auto }
table.data { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
table.data th {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--darksage);
    text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--putty); background: var(--offwhite);
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px }
table.data tr:last-child td { border-bottom: none }
td.muted { color: var(--darksage); font-size: 12.5px }
tr.notoffered td { opacity: .55 }

.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 11.5px; font-weight: 600 }
.chip.sage { background: rgba(163, 185, 163, .3); color: var(--chip-sage-text) }
.chip.teal { background: rgba(53, 92, 107, .14); color: var(--chip-teal-text) }
.chip.ochre { background: rgba(217, 130, 43, .16); color: var(--chip-ochre-text) }
.chip.red { background: rgba(184, 83, 58, .13); color: var(--chip-red-text) }
.chip.grey { background: var(--offwhite); color: var(--charcoal); border: 1px solid var(--line) }

/* ---------- rate cards ---------- */
.cardrow { display: flex; gap: 12px; flex-wrap: wrap }
.cardtile {
    background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px;
    text-align: left; min-width: 212px; display: flex; flex-direction: column; gap: 7px;
}
.cardtile:hover { border-color: var(--putty) }
.cardtile.on { border-color: var(--darksage); box-shadow: inset 0 0 0 1px var(--darksage) }
.ct-top { display: flex; align-items: center; gap: 8px }
.ct-name { font-weight: 600; font-size: 14px }
.ct-meta { display: flex; gap: 6px; flex-wrap: wrap }
.ct-sub { font-size: 11.5px; color: var(--darksage) }

input.rateinp {
    width: 120px; border: 1px solid var(--putty); background: var(--white);
    border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 13px;
}
input.rateinp:focus { outline: none; border-color: var(--darksage) }
tr.notoffered input.rateinp { border-style: dashed }
input.rateinp:disabled { background: var(--offwhite); color: var(--charcoal); opacity: .8; cursor: default }

/* An invalid rate is not a blank one, so it must not read as "not offered".
 * Declared after the notoffered rules deliberately: a row is both classes at
 * once and this is the one that should win. */
tr.bad td { opacity: 1 }
tr.bad input.rateinp { border-color: var(--error); border-style: solid }
tr.bad td[data-eq] { color: var(--error); font-weight: 600 }

.secthead { display: flex; align-items: center; gap: 14px; margin: 0 0 10px; flex-wrap: wrap }
.secthead h3 { font-size: 15px; font-weight: 600 }
.secthead .grow { margin-left: auto }
.tnote { font-size: 12.5px; color: var(--darksage); margin-top: 10px; max-width: 820px; line-height: 1.5 }

/* The version bar. Interface principle 2: state legible at a glance, so the
 * left border carries the lifecycle state without needing a legend. */
.verbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--putty);
    border-radius: 10px; padding: 11px 15px; margin: 0 0 14px;
}
.verbar.draft { border-left-color: var(--ochre) }
.verbar.pending_approval { border-left-color: var(--teal) }
.verbar.approved { border-left-color: var(--darksage) }
.verbar.rejected { border-left-color: var(--error) }
.verbar .vtitle { font-weight: 600; font-size: 13.5px }
.verbar .vmeta { font-size: 12.5px; color: var(--darksage) }
.verbar .vacts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap }

.findings { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--error); border-radius: 10px; padding: 12px 15px; margin-bottom: 14px }
.findings h4 { font-size: 13px; font-weight: 600; margin-bottom: 8px }
.finding { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12.5px; flex-wrap: wrap }
.finding:first-of-type { border-top: none }
.finding .fgrow { margin-left: auto }

.empty { background: var(--white); border: 1px dashed var(--putty); border-radius: 10px; padding: 26px; text-align: center; color: var(--darksage) }
.empty h3 { font-size: 15px; color: var(--charcoal); margin-bottom: 6px }
.empty p { max-width: 460px; margin: 0 auto 14px; line-height: 1.5; font-size: 13px }

/* ---------- sign in ---------- */
#signin { margin: auto; width: 100%; max-width: 360px; padding: 32px }
#signin .brand { margin-bottom: 22px }
#signin .brand .eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .1em; color: var(--darksage) }
#signin .brand h1 { font-size: 24px; font-weight: 600; margin-top: 3px }
#signin label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--darksage); margin: 14px 0 5px }
#signin input { width: 100%; border: 1px solid var(--putty); background: var(--white); border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 14px }
#signin input:focus { outline: none; border-color: var(--darksage) }
#signin button { width: 100%; margin-top: 20px; padding: 10px }
#signin .note { font-size: 12px; color: var(--darksage); margin-top: 16px; line-height: 1.5 }

/* ---------- feedback ---------- */
#toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
    background: var(--ink); color: var(--offwhite); border-radius: 999px;
    padding: 10px 20px; font-size: 13px; box-shadow: 0 8px 20px rgba(33, 40, 35, .35);
    z-index: 80; max-width: min(680px, 92vw); display: none;
}
#toast.bad { background: var(--error) }
#toast.show { display: block }

#modalbg { position: fixed; inset: 0; background: rgba(33, 40, 35, .38); z-index: 90; display: none }
#modal {
    position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%);
    background: var(--white); border-radius: 12px; padding: 22px 24px;
    width: min(460px, 92vw); box-shadow: 0 20px 50px rgba(33, 40, 35, .32); display: none;
    /* A form long enough to overflow was previously cut off at BOTH ends,
     * so the title and the Save button were unreachable on a short screen. */
    max-height: calc(100vh - 40px); overflow-y: auto;
}
#modal .macts {
    position: sticky; bottom: -22px; background: var(--white);
    padding: 12px 0 2px; margin-bottom: -2px;
}
#modalbg.show, #modal.show { display: block }
#modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px }
#modal .msub { font-size: 12.5px; color: var(--darksage); margin-bottom: 14px; line-height: 1.5 }
#modal label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--darksage); margin: 12px 0 5px }
#modal input, #modal select, #modal textarea {
    width: 100%; border: 1px solid var(--putty); background: var(--white);
    border-radius: 8px; padding: 8px 11px; font: inherit; font-size: 13.5px; color: var(--charcoal);
}
#modal input:focus, #modal select:focus, #modal textarea:focus { outline: none; border-color: var(--darksage) }
#modal .macts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px }
#modal h3 { position: sticky; top: -22px; background: var(--white); padding-top: 2px; z-index: 1 }

/* ---------- users ---------- */
tr.urow { cursor: pointer }
tr.urow:hover td { background: rgba(163, 185, 163, .14) }
tr.urow.inactive td { opacity: .5 }
.usub { font-size: 11.5px; color: var(--darksage); margin-top: 2px }

/* ---------- settings ---------- */
.setgroup {
    background: var(--white); border: 1px solid var(--line); border-radius: 10px;
    padding: 15px 18px; margin-bottom: 14px; max-width: 860px;
}
.setgroup .secthead { margin-bottom: 8px }
.setrow { display: flex; flex-direction: column; gap: 4px }
.setpair { display: flex; gap: 12px; align-items: baseline; padding: 3px 0 }
.setlabel { font-size: 12px; color: var(--darksage); min-width: 190px }
.setval { font-size: 15px; font-weight: 600 }

/* ---------- work pattern control ---------- */
/* Seven equal columns, never wrapping. As a flex row the seventh day
 * wrapped onto its own line and stretched full width, which read as a
 * different kind of field rather than the last day of the week. */
.patgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px }
.patday { display: flex; flex-direction: column; gap: 3px; min-width: 0 }
.patday span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--darksage) }
.patday input {
    width: 100%; border: 1px solid var(--putty); background: var(--white);
    border-radius: 6px; padding: 6px 7px; font: inherit; font-size: 13px; text-align: center;
}
.patday input:focus { outline: none; border-color: var(--darksage) }
.pathelp { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap }
.pathelp .pattotal { font-size: 12px; color: var(--darksage); margin-left: auto }

.loading { padding: 40px 28px; color: var(--darksage) }

/* ---------- display type ---------- */
/* DELIBERATELY LAST, and it has to stay last.
 * These selectors are the same ones the component sections use, at the same
 * specificity, so whichever appears later in the file wins. Sitting up with
 * the shell it lost font-size and font-weight to the component rules while
 * still winning font-family, which is the worst of both: Instrument Serif
 * asked for at weight 600, a weight it does not have, so the browser
 * synthesised one. Verified in the browser, not assumed: #signin .brand h1
 * computed to 600 at 24px. It stays above the media query so a narrow screen
 * can still shrink the wordmark. */
/* Instrument Serif, one weight, display slots only. Never on a number: the
 * rate tables stay in Inter so an FD reads figures in a face built for them.
 * The size nudges are not decoration. A serif at the same px reads smaller
 * than Inter does, and dropping from 600 to 400 removes weight as well, so
 * without them a page title would come out quieter than the row beneath it. */
#logo h1,
.topbar h2,
#signin .brand h1,
.empty h3,
#modal h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-synthesis-weight: none;
    letter-spacing: 0;
}
#logo h1 { font-size: 21px }
.topbar h2 { font-size: 25px }
#signin .brand h1 { font-size: 27px }
.empty h3 { font-size: 17px }
#modal h3 { font-size: 18px }

/* Section headings stay in Inter, and this is the one place the build departs
 * from the letter of the 24 August decision, which said "page titles, section
 * headings". Rendered side by side, the serif version loses: a .secthead h3 is
 * 15px in a face with one weight, and it sits directly above a table header
 * row set in bold uppercase Inter. The heading came out LIGHTER than the
 * columns it was supposed to be the parent of, so the serif was destroying the
 * hierarchy it was there to create. Evidence: docs/screens/tokens-secthead-compare.png.
 * The display face is kept for slots where nothing competes with it: the
 * wordmark, the page title, the sign-in brand, an empty state and a modal
 * title. Reverting is adding .secthead h3 back to the selector list above. */

@media (max-width: 720px) {
    body { display: block }
    #sidebar { width: 100%; min-width: 0; flex-direction: row; align-items: center; padding: 10px 0; flex-wrap: wrap }
    #logo { border-bottom: none; margin-bottom: 0; padding: 0 16px; width: auto }
    #logo h1 { font-size: 16px }
    #sidebar .navitem { width: auto; border-left: 0; border-bottom: 3px solid transparent; padding: 8px 14px }
    #sidebar .navitem.active { border-left-color: transparent; border-bottom-color: var(--sage) }
    /* A section heading does not read as a grouping in a horizontal bar,
     * it reads as another nav item that does nothing when tapped. */
    .navsection { display: none }
    #whoami { border-top: none; padding: 8px 16px; margin-left: auto }
    #whoami .em { display: none }
    #whoami button { margin-top: 0 }
    .tablewrap, .topbar { padding-left: 16px; padding-right: 16px }
}
