/* Internal Audit Weekly. Palette supplied by Bos Ryan:
   #AE862B #D3AF5C #9D845C #000000 #959383 #CDC8BB. Extended neutrals are design choices. */
:root {
  --gold: #ae862b;
  --lightgold: #d3af5c;
  --bronze: #9d845c;
  --sage: #959383;
  --stone: #cdc8bb;
  --ink: #23221e;
  --muted: #6e6b62;
  --paper: #f7f5f0;
  --card: #fffdfa;
  --line: #e5dfd2;
  --rail: #191a17;
  --danger: #a1262c;
  --danger-bg: #fdecee;
  --ok: #3f6b3a;
  --ease-in: cubic-bezier(0.2, 0, 0, 1);
  --serif: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 'Segoe UI', system-ui, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { transition: background 160ms ease, border-color 160ms ease, color 160ms ease; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.boot img { object-fit: contain; }

/* Login ------------------------------------------------------------------ */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); }
.login-art { background: var(--rail); color: #eae7de; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art img.archi { width: 150px; height: 64px; object-fit: contain; object-position: left center; }
.login-art h1 { font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1.12; letter-spacing: -1.4px; color: #f3ead2; max-width: 440px; }
.login-art p { color: #b7a985; font-size: 13px; margin-top: 16px; max-width: 380px; line-height: 1.7; }
.brand-pair { display: flex; gap: 10px; align-items: center; background: #fff; padding: 10px 12px; border-radius: 8px; width: max-content; max-width: 100%; }
.brand-pair img { height: 34px; width: auto; max-width: 120px; object-fit: contain; }
.login-form { padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px; background: var(--card); }
.login-form h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; letter-spacing: -0.6px; }
.login-form .hint { color: var(--muted); font-size: 12px; line-height: 1.7; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; font-weight: 600; }
.field em { font-style: normal; font-weight: 400; color: #817969; font-size: 11px; margin-left: 4px; }
.input-wrap { display: flex; border: 1px solid #ded5c1; border-radius: 8px; background: #fff; overflow: hidden; }
.input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px #ae862b26; }
.input-wrap input { flex: 1; min-width: 0; border: 0; padding: 12px 13px; outline: none; background: transparent; font-size: 14px; }
.input-wrap button { border: 0; background: transparent; padding: 0 14px; color: var(--muted); }
.input-wrap button:hover { color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 18px; border-radius: 8px; border: 1px solid #26231a; background: #26231a; color: #f6df9f; font-size: 13px; font-weight: 500; }
.btn:hover { background: #3d3420; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #d6d0c2; }
.btn.ghost:hover { background: #f3eee2; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.btn.danger { background: #fff; color: var(--danger); border-color: #e7c1c3; }
.notice { border-radius: 8px; padding: 11px 13px; font-size: 12px; line-height: 1.6; }
.notice.error { background: var(--danger-bg); color: var(--danger); }
.notice.info { background: #f0e8d7; color: #6c592c; }
.notice.ok { background: #e9f1e4; color: var(--ok); }

/* Shell -------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 172px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); color: #eae7de; padding: 30px 14px 22px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.rail .archi { width: 124px; height: 52px; object-fit: contain; object-position: left center; margin-left: 4px; }
.rail .dept { font-size: 10px; letter-spacing: 0.14em; color: #b7a985; text-transform: uppercase; margin: 32px 8px 12px; }
.nav { display: grid; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; border-radius: 8px; padding: 11px 10px; background: transparent; color: #cfc8b5; font-size: 12px; }
.nav button:hover { background: #2a2720; color: #f0e3c2; }
.nav button[aria-current='page'] { background: #393326; color: #edd5a0; }
.rail-bottom { margin-top: auto; display: grid; gap: 12px; }
.rail-bottom .brand-pair { width: 100%; padding: 8px; }
.rail-bottom .brand-pair img { width: 48%; height: 30px; }
.rail-bottom p { font-size: 10px; color: #8f8b7e; padding: 0 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; padding: 14px 28px; border-bottom: 1px solid var(--line); background: #fffdfaee; backdrop-filter: blur(6px); display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; }
.crumb { color: var(--muted); }
.crumb b { color: var(--ink); font-weight: 500; }
.account { display: flex; align-items: center; gap: 10px; }
.account small { display: block; color: var(--muted); font-size: 11px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: #ece5d4; border: 1px solid #dfd3b7; color: #74571c; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--ink); background: #f3eee2; }
.content { padding: 28px; max-width: 1280px; width: 100%; }

.eyebrow { font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: #8a6b25; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); display: inline-block; flex: none; }
.heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin: 13px 0 24px; flex-wrap: wrap; }
.heading h1 { font-family: var(--serif); font-size: 40px; line-height: 1.15; font-weight: 400; letter-spacing: -1.5px; color: #29271f; }
.subtitle { color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 8px; max-width: 440px; }
.label { font-size: 11px; display: block; color: var(--muted); margin-bottom: 5px; }
select { border: 1px solid #c7c1b3; border-radius: 8px; background: #fff; padding: 9px 30px 9px 11px; font-size: 12px; min-height: 40px; max-width: 100%; }

/* My week ------------------------------------------------------------------ */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 12px 0; font-size: 12px; }
.tabs button[aria-pressed='true'] { color: #5c471e; border-bottom-color: var(--gold); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin-bottom: 18px; }
.days button { min-height: 76px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: #716d62; padding: 9px 3px; font-size: 11px; position: relative; }
.days button b { display: block; font-family: var(--serif); font-weight: 400; font-size: 20px; color: #24231f; line-height: 1.35; }
.days button small { display: block; font-size: 9px; color: #8b816e; min-height: 14px; }
.days button.weekend { background: #eeebe3; border-style: dashed; }
.days button[aria-pressed='true'] { background: #e8d8af; border: 1px solid var(--gold); color: #4e3a16; box-shadow: 0 2px 6px #9d845c1f; }
.days button .mark { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--sage); }
.days button .mark.dirty { background: var(--lightgold); }
.days button.today::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 14px; height: 2px; margin-left: -7px; border-radius: 2px; background: var(--gold); }

.paper { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 23px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.paper-title { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.paper-title h2 { font-family: var(--serif); font-size: 21px; font-weight: 400; letter-spacing: -0.45px; }
.paper .full { grid-column: 1 / -1; }
.paper .field > span { font-weight: 500; font-size: 13px; }
textarea { width: 100%; min-height: 172px; resize: vertical; border: 1px solid #ded5c1; border-radius: 8px; padding: 13px; font-size: 13px; line-height: 1.85; background: #fff; display: block; }
textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px #ae862b26; }
textarea.short { min-height: 92px; }
.savebar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.save-status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.save-status .dot.saving { background: var(--lightgold); animation: pulse 900ms ease-in-out infinite alternate; }
.save-status .dot.error { background: var(--danger); }
.save-status .dot.saved { background: var(--ok); }
.save-status.error { color: var(--danger); }
.info-line { grid-column: 1 / -1; font-size: 11px; color: #756f60; display: flex; gap: 7px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; background: #edece4; color: #585849; border-radius: 4px; font-size: 10px; font-weight: 500; }
.pill.draft { background: #f5ecd6; color: #765b20; }
.pill.none { background: #f1efe9; color: #8a877d; }
.pill.test { background: #e6eef5; color: #3b5a75; }
.conflict { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }

/* Team week ---------------------------------------------------------------- */
.strip { display: flex; align-items: center; gap: 22px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.strip strong { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--ink); margin-right: 5px; }
.strip .quiet { margin-left: auto; font-size: 11px; }
.filterbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filterbar h2 { font-size: 14px; font-weight: 500; }
.filterbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card { border: 1px solid #ded7c8; background: var(--card); border-radius: 13px; overflow: clip; transition: border-color 180ms ease, box-shadow 180ms ease; }
.card:hover { border-color: #c2ac76; box-shadow: 0 5px 18px #29220f0a; }
.card.open { grid-column: 1 / -1; }
.card-row { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 17px; padding: 21px; }
.person { grid-column: 1 / -1; display: flex; gap: 11px; align-items: flex-start; padding-right: 40px; }
.person .name { font-size: 13px; font-weight: 600; line-height: 1.5; }
.person .position { font-size: 11px; color: var(--muted); line-height: 1.5; }
.person .pill { margin-top: 8px; }
.snippet { font-size: 12px; line-height: 1.75; min-width: 0; overflow-wrap: anywhere; }
.snippet h3 { text-transform: uppercase; letter-spacing: 0.1em; color: #8a6b30; font-size: 10px; font-weight: 500; margin-bottom: 6px; }
.snippet .muted, .muted { color: var(--muted); }
.snippet small { display: block; font-size: 10px; color: #827969; border-top: 1px solid #eee8da; padding-top: 9px; margin-top: 10px; }
.expand { position: absolute; right: 16px; top: 18px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid #e0d5bc; background: #f5efdf; color: #836626; display: inline-flex; align-items: center; justify-content: center; }
.expand svg { transition: transform 200ms var(--ease-in); }
.expand[aria-expanded='true'] svg { transform: rotate(180deg); }
.detail { background: #f6f1e6; padding: 4px 21px 20px; border-top: 1px solid var(--line); animation: enter 200ms var(--ease-in) both; }
.detail-title { font-size: 12px; padding: 13px 0; color: #665328; font-weight: 500; }
.day-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.day-table th { text-align: left; font-weight: 500; color: #766d5d; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.day-table td { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.day-table th:first-child { width: 15%; }
.day-table td:first-child { color: #776849; white-space: normal; }
.day-table td:first-child small { display: block; color: #8b816e; font-size: 10px; }
.day-table tr.weekend td { background: #f2eee3; }
.empty { padding: 32px 4px; color: var(--muted); font-size: 13px; }
.foot { display: flex; justify-content: space-between; gap: 14px; margin-top: 18px; font-size: 10px; color: var(--muted); flex-wrap: wrap; }
.palette { display: flex; gap: 3px; align-items: center; }
.palette span { width: 13px; height: 6px; border-radius: 1px; }
.palette .p1 { background: #ae862b; } .palette .p2 { background: #d3af5c; } .palette .p3 { background: #9d845c; }
.palette .p4 { background: #000; } .palette .p5 { background: #959383; } .palette .p6 { background: #cdc8bb; }

/* Profile and admin -------------------------------------------------------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 23px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.panel h2 { font-family: var(--serif); font-weight: 400; font-size: 21px; letter-spacing: -0.4px; margin-bottom: 14px; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 18px; }
dl.facts { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 12px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.stack { display: grid; gap: 14px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0 16px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table.users { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 760px; }
table.users th { text-align: left; font-weight: 500; color: #766d5d; background: #eeebe3; padding: 11px 12px; font-size: 11px; }
table.users td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.users code { font-family: Consolas, monospace; font-size: 12px; background: #f3eee2; padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }
.reset { display: flex; gap: 6px; margin-top: 8px; }
.reset input { flex: 1; min-width: 0; border: 1px solid #ded5c1; border-radius: 6px; padding: 6px 8px; font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #26231a; color: #f6df9f; padding: 11px 16px; border-radius: 8px; font-size: 12px; box-shadow: 0 12px 40px #18212f24; animation: enter 200ms var(--ease-in) both; z-index: 20; max-width: calc(100vw - 32px); }

@keyframes enter { from { opacity: 0.2; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.toast { animation-name: toast-in; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }

@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; gap: 28px; }
  .login-art h1 { font-size: 34px; }
  .login-form { padding: 32px 24px 48px; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .rail { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 16px; }
  .rail .archi { width: 92px; height: 36px; margin: 0; }
  .rail .dept, .rail-bottom { display: none; }
  .nav { display: flex; margin-left: auto; gap: 2px; }
  .nav button { padding: 9px; }
  .nav button span { display: none; }
  .topbar { position: static; padding: 12px 16px; }
  .content { padding: 20px 16px 40px; }
  .heading h1 { font-size: 32px; }
  .paper { grid-template-columns: 1fr; padding: 17px; gap: 18px; }
  .days { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .days button { min-height: 64px; }
  .days button:nth-child(n+5) { grid-column: span 1; }
  textarea { font-size: 16px; min-height: 132px; }
  .card-row { grid-template-columns: 1fr; padding: 18px; }
  .day-table thead { display: none; }
  .day-table, .day-table tbody, .day-table tr, .day-table td { display: block; width: 100%; }
  .day-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .day-table td { border: 0; padding: 4px 0; }
  .day-table td[data-label]::before { content: attr(data-label); display: block; color: #8a6d30; font-size: 10px; }
  .strip .quiet { width: 100%; margin: 0; }
  .account .who { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
