/* 2M Corp Medical Reimbursements
   Brand: black / cod gray / mine shaft / white, gold reserved for accents.
   Type: Palatino Linotype throughout. No framework; this file is the whole design. */

:root {
  --ink: #0d0d0d;
  --ink-2: #222222;
  --ink-3: #333333;
  --muted: #6d6a66;
  --line: #e4e2de;
  --line-strong: #b9b6b0;
  --paper: #ffffff;
  --paper-2: #f8f7f4;
  --gold: #b88746;
  --gold-2: #d4ad6a;
  --gold-pale: #f5eee0;
  --ok: #2f6b3f;   --ok-bg: #eaf3ed;
  --warn: #7a4f00; --warn-bg: #fbf1dc;
  --bad: #8b1e1e;  --bad-bg: #f9e9e9;
  --info: #2b4c7e; --info-bg: #e9eef6;
  --font: "Palatino Linotype", Palatino, "Book Antiqua", "Palatino LT STD", "URW Palladio L", Georgia, serif;
  --radius: 2px;
  --measure: 1120px;
}

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

html { font-size: 17px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold); }
small, .small-text { font-size: 0.86rem; }
em { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* --- Type ------------------------------------------------------------- */

h1, h2, h3, h4 { font-family: var(--font); font-weight: 400; color: var(--ink); line-height: 1.2; margin: 0 0 0.6rem; }
h1 { font-size: 2.1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; margin-top: 0.25rem; }
h4 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.25rem 0 0.4rem; }
h4:first-child { margin-top: 0; }
p { margin: 0 0 1rem; }

main > h1:first-child, main > hgroup:first-child, main > h1.page-title, main > hgroup {
  padding-top: 0.75rem;
  margin-bottom: 1.5rem;
  position: relative;
}
main > h1:first-child::before, main > hgroup:first-child::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  background: var(--gold);
  margin-bottom: 0.9rem;
}
hgroup h1 { margin-bottom: 0.2rem; }
hgroup p { color: var(--muted); margin: 0; }

/* --- Layout ------------------------------------------------------------ */

.container { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
main.container { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }
main.container:has(> .login-shell) { max-width: none; padding: 0; }

/* --- Header ---------------------------------------------------------- */

.site-header { background: var(--ink); color: #fff; border-bottom: 3px solid var(--gold); }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; color: #fff; padding: 0.75rem 0; flex-shrink: 0; }
.brand img { width: 118px; height: 20px; display: block; flex-shrink: 0; }
.nav-row { background: #1a1a1a; border-top: 1px solid #2c2c2c; }
.nav-row .site-nav { min-height: 44px; }
.nav-row .cta { margin-left: auto; }
.brand .app-name { border-left: 1px solid rgba(255,255,255,0.28); padding-left: 0.9rem; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-2); white-space: nowrap; }
.brand:hover .app-name { color: #fff; }

.site-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.site-nav > li { position: relative; }
.site-nav a, .site-nav summary { display: block; color: rgba(255,255,255,0.86); text-decoration: none; padding: 0.55rem 0.6rem; font-size: 0.92rem; border-bottom: 2px solid transparent; cursor: pointer; }
.site-nav a:hover, .site-nav summary:hover, .site-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--gold); }
.site-nav .cta a { border: 1px solid var(--gold-2); color: var(--gold-2); padding: 0.35rem 0.9rem; margin: 0.25rem 0; }
.site-nav .cta a:hover { background: var(--gold-2); color: var(--ink); border-bottom-color: var(--gold-2); }

details.dropdown { position: relative; }
details.dropdown summary { list-style: none; }
details.dropdown summary::-webkit-details-marker { display: none; }
details.dropdown summary::after { content: " \25BE"; font-size: 0.75em; opacity: 0.7; }
details.dropdown ul {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  min-width: 14rem; margin: 0; padding: 0.4rem 0; list-style: none;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}
details.dropdown ul li a, details.dropdown ul li button.link {
  display: block; width: 100%; text-align: left; padding: 0.5rem 1rem; color: var(--ink-2);
  text-decoration: none; border: 0; border-bottom: 0; font: inherit; background: none; cursor: pointer;
}
details.dropdown ul li a:hover, details.dropdown ul li button.link:hover { background: var(--paper-2); color: var(--ink); }
details.dropdown ul li.meta { padding: 0.35rem 1rem 0.5rem; font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }

/* --- Footer ------------------------------------------------------------ */

.site-footer { border-top: 1px solid var(--line); padding: 1.25rem 0; color: var(--muted); font-size: 0.82rem; }
.site-footer .container { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.site-footer img { height: 16px; width: auto; opacity: 0.8; }

/* --- Sections ---------------------------------------------------------- */

article { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
article > header { font-weight: 700; color: var(--ink); margin: -0.25rem 0 0.9rem; }
article > footer { margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.86rem; }
article h3:first-child { margin-top: 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }

article.balance { background: var(--paper-2); border-top: 3px solid var(--gold); }
article.balance .grid { grid-template-columns: repeat(6, 1fr); gap: 0.75rem 1rem; align-items: end; }
article.balance .grid > div small { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.15rem; }
article.balance .grid > div { font-size: 1.3rem; font-variant-numeric: tabular-nums; color: var(--muted); }
article.balance .grid strong { font-size: 1.3rem; font-weight: 400; color: var(--ink); }
article.balance .grid strong.danger { color: var(--bad); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem 1.25rem; }
.narrow { max-width: 30rem; margin: 3rem auto; }

/* --- Flash messages ---------------------------------------------------- */

.flash { padding: 0.75rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--ink); margin-bottom: 1rem; background: var(--paper-2); }
.flash.success { border-left-color: var(--ok); background: var(--ok-bg); }
.flash.info { border-left-color: var(--info); background: var(--info-bg); }
.flash.warning { border-left-color: var(--gold); background: var(--warn-bg); }
.flash.error { border-left-color: var(--bad); background: var(--bad-bg); }

/* --- Badges ------------------------------------------------------------- */

.badge { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 0.18rem 0.55rem; border-radius: var(--radius); border: 1px solid; white-space: nowrap; vertical-align: middle; line-height: 1.4; }
.badge.secondary { color: var(--muted); border-color: var(--line-strong); background: var(--paper-2); }
.badge.info { color: var(--info); border-color: #b9c8de; background: var(--info-bg); }
.badge.warning { color: var(--warn); border-color: #e0c48a; background: var(--warn-bg); }
.badge.success { color: var(--ok); border-color: #a9cbb4; background: var(--ok-bg); }
.badge.danger { color: var(--bad); border-color: #dcaaaa; background: var(--bad-bg); }
h1 .badge { font-size: 0.72rem; margin-left: 0.5rem; position: relative; top: -0.35rem; }
.danger { color: var(--bad); }

/* --- Tables ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-bottom: 0.5rem; }
th, td { padding: 0.6rem 0.6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 1px solid var(--line-strong); }
tfoot th { border-top: 1px solid var(--line-strong); border-bottom: 0; color: var(--ink); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--paper-2); }
td small { color: var(--muted); }

/* --- Buttons ------------------------------------------------------------- */

button, [role="button"], input[type="submit"] {
  display: inline-block; font: inherit; font-size: 0.95rem; line-height: 1.2;
  padding: 0.55rem 1.1rem; border-radius: var(--radius); cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  margin: 0 0.35rem 0.35rem 0; vertical-align: middle;
}
button:hover, [role="button"]:hover, input[type="submit"]:hover { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }
.secondary, button.secondary, [role="button"].secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.secondary:hover, button.secondary:hover, [role="button"].secondary:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-3); }
.outline, [role="button"].outline, button.outline { background: transparent; }
.contrast, button.contrast, [role="button"].contrast { background: var(--paper); color: var(--bad); border-color: var(--bad); }
.contrast:hover, button.contrast:hover, [role="button"].contrast:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
[role="button"].small, button.small { padding: 0.3rem 0.75rem; font-size: 0.84rem; margin: 0; }
button.link { background: none; border: 0; color: var(--ink); padding: 0; margin: 0; display: inline; font: inherit; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; cursor: pointer; }
button.link:hover { color: var(--gold); background: none; }
button.link.danger { color: var(--bad); text-decoration-color: var(--bad); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0 1.25rem; }
.actions [role="button"], .actions button { margin: 0; }
p.actions { margin-top: 0; }

/* --- Forms ---------------------------------------------------------------- */

form.inline { display: inline; }
form.inline label { display: inline-block; font-size: 0.9rem; }
form.inline select { width: auto; display: inline-block; margin-left: 0.4rem; }
form.grid { align-items: end; }

label { display: block; font-size: 0.9rem; color: var(--ink-3); margin-bottom: 0.3rem; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink);
  width: 100%; padding: 0.5rem 0.65rem; margin: 0 0 0.9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-pale); }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0 0.45rem 0 0; vertical-align: -0.1rem; accent-color: var(--ink); }
input[type="file"] { padding: 0.35rem; background: var(--paper-2); }
select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23333' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.7rem center; padding-right: 2rem; }
textarea { min-height: 5rem; resize: vertical; }
label > input[type="checkbox"] + span, label > input[type="checkbox"] { margin-bottom: 0; }
.field { margin-bottom: 1rem; }
.field input, .field select, .field textarea { margin-bottom: 0; }
.helptext { display: block; font-size: 0.82rem; color: var(--muted); margin: -0.15rem 0 0.4rem; }
ul.errorlist { list-style: none; margin: 0 0 0.4rem; padding: 0; color: var(--bad); font-size: 0.86rem; }
ul.errorlist.nonfield { margin: 0 0 1rem; }
.field > label > input[type="checkbox"] { margin-right: 0.5rem; }
form > article label input[type="checkbox"] { margin-right: 0.5rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

fieldset.line-decision { border: 1px solid var(--line); border-radius: 3px; padding: 0.9rem 1rem 0.2rem; margin-bottom: 0.9rem; background: var(--paper-2); }
fieldset.line-decision legend { padding: 0 0.4rem; font-size: 0.95rem; }
fieldset.line-decision label { display: block; }
fieldset.line-decision div > label { font-size: 0.9rem; }
fieldset.line-decision input[type="radio"] + label { display: inline; }
fieldset.line-decision div:first-child label { display: block; margin: 0.15rem 0; color: var(--ink-2); }

#lines input, #lines select { margin-bottom: 0; }
#lines td { padding: 0.35rem 0.35rem; }
#lines th:last-child, #lines td:last-child { width: 4rem; text-align: center; }

/* --- Lists ----------------------------------------------------------------- */

ul.history { list-style: none; padding-left: 0; margin: 0; }
ul.history li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
ul.history li:last-child { border-bottom: 0; }
ul.history small { display: inline-block; min-width: 9.5rem; color: var(--muted); font-variant-numeric: tabular-nums; }
ul.docs { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.docs li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
ul.docs li:last-child { border-bottom: 0; }

/* --- Sign-in page ------------------------------------------------------------ */

.login-shell { display: grid; grid-template-columns: minmax(280px, 5fr) minmax(320px, 6fr); min-height: 100vh; }
.login-brand { background: var(--ink); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 3rem 2rem; text-align: center; }
.login-brand img { width: min(320px, 70%); height: auto; }
.login-brand .app-name { margin-top: 2.5rem; font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-2); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 3rem 1.5rem; }
.login-panel > div { width: 100%; max-width: 380px; }
.login-panel h1 { font-size: 1.7rem; margin-bottom: 1.5rem; }
.login-panel h1::before { content: ""; display: block; width: 2.5rem; height: 3px; background: var(--gold); margin-bottom: 0.9rem; }
.login-panel [role="button"], .login-panel button { width: 100%; text-align: center; margin: 0 0 0.75rem; padding: 0.7rem 1rem; }
.login-panel details { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.login-panel details summary { cursor: pointer; font-size: 0.9rem; color: var(--muted); }
.login-panel details form { margin-top: 1rem; }
.login-panel .foot { margin-top: 2.5rem; font-size: 0.8rem; color: var(--muted); }

/* --- Responsive ----------------------------------------------------------------- */

@media (max-width: 960px) {
  article.balance .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  html { font-size: 16px; }
  article.balance .grid { grid-template-columns: repeat(2, 1fr); }
  article.balance .grid > div, article.balance .grid strong { font-size: 1.15rem; }
  .brand .app-name { display: none; }
  .nav-row .site-nav { padding: 0.25rem 0; }
  .nav-row .cta { margin-left: 0; }
  main.container { padding-top: 1.25rem; }
  article { padding: 1rem; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 2.5rem 1.5rem; min-height: 40vh; }
  .login-brand img { width: 220px; }
  details.dropdown ul { right: auto; left: 0; }
}
