:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142b3c;
  background: #f3f6f8;
  font-synthesis: none;
  --navy: #0c2235;
  --ink: #142b3c;
  --muted: #506477;
  --border: #dce5eb;
  --accent: #006d65;
  --white: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .65; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #23a598; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link { position: absolute; z-index: 2; top: .6rem; left: 1rem; padding: .75rem; background: var(--white); color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-size: 1.25rem; letter-spacing: -.05em; white-space: nowrap; }
.brand > span {
  display: grid; place-items: center; width: 2.05rem; height: 2.05rem;
  padding-right: .05rem; color: #063c3a; background: #83e0d2;
  border-radius: .5rem; font-size: 1.17rem; font-weight: 850; font-style: italic;
}
.brand > b { margin-left: .1rem; padding-left: .63rem; border-left: 1px solid #547081; font-size: .95rem; letter-spacing: 0; font-weight: 650; color: #b5c9d7; }
.brand-large { margin-bottom: 2.65rem; }
.brand-large > span { width: 2.5rem; height: 2.5rem; font-size: 1.4rem; }
.brand-large > strong { font-size: 1.55rem; }

.login-shell {
  display: grid; place-items: center; min-height: 100vh; min-height: 100svh;
  padding: 1.25rem;
  background-color: var(--navy);
  background-image: radial-gradient(ellipse at top right, rgba(15,103,105,.75), transparent 47%),
    linear-gradient(rgba(192,229,239,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(192,229,239,.08) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}
.login-card {
  width: min(100%, 27rem); padding: clamp(1.5rem, 6vw, 2.85rem);
  background: var(--white); border-radius: 1.1rem;
  box-shadow: 0 1.5rem 5rem rgba(1,16,28,.36);
}
.login-card h1 { font-size: clamp(2rem, 6vw, 2.7rem); letter-spacing: -.055em; line-height: 1.06; }
.login-copy { margin: .9rem 0 1.6rem; color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: .48rem; }
.login-form label { color: var(--ink); font-size: .94rem; font-weight: 700; }
.login-form input {
  width: 100%; min-height: 2.8rem; border: 1px solid #c7d5df;
  border-radius: .5rem; color: var(--ink); background: var(--white); padding: .58rem .75rem;
}
.login-form input + label { margin-top: .36rem; }
.login-button { width: 100%; margin-top: .7rem; }
.access-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.saha-help { display: inline-block; margin-top: .45rem; color: #00645e; font-size: .92rem; font-weight: 700; }
.login-status { min-height: 1.3rem; color: var(--muted); font-size: .9rem; line-height: 1.6; margin-top: .8rem; }
.login-status:empty { display: none; }
.login-status[data-error="true"] { color: #9a3323; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.65rem; padding: .62rem .95rem; border-radius: .5rem;
  border: 1px solid transparent; font-weight: 700; font-size: .91rem;
}
.button-primary { color: var(--white); background: var(--accent); }
.button-primary:not(:disabled):hover { background: #005b55; }
.button-secondary { color: var(--ink); background: var(--white); border-color: #cad7e0; }
.button-secondary:not(:disabled):hover { background: #edf4f7; }
.button-quiet { color: #00645e; background: transparent; margin-top: .45rem; margin-left: -.7rem; }
.button-quiet:hover { text-decoration: underline; }

.topbar { background: var(--navy); color: var(--white); }
.topbar-content {
  max-width: 76rem; min-height: 4.25rem; padding: .6rem 1.5rem; margin: 0 auto;
  display: flex; gap: .5rem; justify-content: space-between; align-items: center;
}
.account { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.account-phone { font-size: .91rem; color: #cfdee6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.button-account { border-color: #597587; color: var(--white); background: transparent; flex: 0 0 auto; }
.button-account:hover { background: #254357; }

.work-area { max-width: 76rem; padding: 2.7rem 1.5rem 4rem; margin: 0 auto; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.65rem; }
.page-title h1 { margin-top: .35rem; font-size: clamp(2.2rem, 5.5vw, 3.25rem); line-height: 1.03; letter-spacing: -.06em; }
.page-date { color: var(--muted); font-size: .94rem; }
.orders { background: var(--white); border: 1px solid var(--border); border-radius: .8rem; }
.list-header { padding: 1.25rem 1.35rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.list-header h2 { font-size: 1.18rem; letter-spacing: -.02em; }
.result-count { margin-top: .3rem; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.filters { display: flex; align-items: center; gap: .65rem; }
.filters input, .filters select {
  width: 100%; min-height: 2.65rem; border: 1px solid #c7d5df; border-radius: .5rem;
  color: var(--ink); background: var(--white); font-size: .94rem; padding: .58rem .75rem;
}
.filters input { min-width: 15rem; }
.filters select {
  appearance: none; min-width: 9.55rem; padding-right: 1.75rem;
  background-image: linear-gradient(45deg, transparent 47%, #526777 51%), linear-gradient(135deg, #526777 49%, transparent 53%);
  background-position: calc(100% - .94rem) center, calc(100% - .69rem) center;
  background-size: .27rem .27rem; background-repeat: no-repeat;
}
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .85rem 1.15rem; border-top: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: 1.35rem; }
th:last-child, td:last-child { padding-right: 1.35rem; text-align: right; }
th { background: #f3f7f9; font-size: .88rem; color: #41586a; white-space: nowrap; }
td { font-size: .95rem; }
tbody tr:hover { background: #f7fafb; }
.order-link {
  display: inline-block; max-width: 100%; border: 0; background: transparent; color: #005d57;
  text-align: left; padding: .15rem 0; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere;
}
.order-link:hover { text-decoration: underline; }
.row-ref { display: block; margin-top: .18rem; color: var(--muted); font-size: .83rem; font-variant-numeric: tabular-nums; }
.date-cell, .qty-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; background: #e9eff3; color: #435b6c; border-radius: .35rem; padding: .25rem .58rem; font-size: .86rem; font-weight: 720; white-space: nowrap; }
.badge[data-state="received"] { color: #174b73; background: #e2effb; }
.badge[data-state="preparing"] { color: #795014; background: #f8edce; }
.badge[data-state="shipped"], .badge[data-state="sent"] { color: #075e49; background: #dbf1e7; }
.badge[data-state="failed"], .badge[data-state="unknown"] { color: #8c3725; background: #fbe8e4; }

.list-feedback, .empty { padding: 1.05rem 1.35rem; border-top: 1px solid var(--border); color: var(--muted); line-height: 1.55; }
.list-feedback[data-error="true"] { color: #923926; background: #fff6f3; }
.pagination { display: flex; justify-content: center; border-top: 1px solid var(--border); padding: 1.1rem; }

.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; border: 0;
  width: min(100%, 36rem); max-width: none; height: 100%; max-height: none;
  background: var(--white); color: var(--ink); padding: 0;
  box-shadow: -.5rem 0 3.5rem rgba(8,32,50,.18);
}
.drawer[open] { display: flex; flex-direction: column; }
.drawer::backdrop { background: rgba(13,34,53,.56); }
.drawer-heading {
  padding: 1.4rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
}
.drawer-heading h2 { margin-top: .2rem; font-size: clamp(1.35rem, 4vw, 1.85rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.detail-id { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.drawer-content { flex: 1; overflow: auto; padding: 0 1.5rem 1.5rem; }
.detail-section { padding: 1.2rem 0; border-bottom: 1px solid var(--border); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { font-size: .97rem; margin-bottom: .65rem; }
.workflow { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.detail-feedback, .order-notes { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.detail-feedback { margin-top: .55rem; }
.detail-feedback[data-error="true"] { color: #923926; }
.contact-fields { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .6rem .9rem; margin: 0; }
.contact-fields dt { color: var(--muted); font-size: .9rem; }
.contact-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.mail-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.mail-actions .button { text-decoration: none; }
.notification-fields { align-items: center; }
.detail-items { display: grid; gap: .6rem; list-style: none; padding: 0; margin: 0; }
.detail-items li {
  display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem;
  padding: .65rem .75rem; background: #f3f7f9; border-radius: .45rem;
  overflow-wrap: anywhere;
}
.detail-items small { color: var(--muted); font-size: .87rem; line-height: 1.45; }
.item-qty { color: #00645e; font-weight: 750; white-space: nowrap; }
.staff-content { padding-top: 1rem; }
.staff-feedback { color: var(--muted); line-height: 1.5; margin: .3rem 0 1rem; }
.staff-feedback[data-error="true"] { color: #923926; }
.staff-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.staff-card { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.staff-card:first-child { padding-top: .3rem; }
.staff-card:last-child { border-bottom: 0; }
.staff-card-heading { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
.staff-card-heading strong { min-width: 0; overflow-wrap: anywhere; }
.staff-card-heading .badge[data-state="pending"] { color: #795014; background: #f8edce; }
.staff-card-heading .badge[data-state="active"] { color: #075e49; background: #dbf1e7; }
.staff-form { margin-top: .7rem; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .65rem; }
.staff-form label { display: flex; gap: .4rem; align-items: center; font-size: .89rem; color: var(--muted); }
.staff-form label:first-child { flex-direction: column; align-items: flex-start; }
.staff-form select {
  min-height: 2.65rem; color: var(--ink); background: var(--white);
  border: 1px solid #cad7e0; border-radius: .5rem; padding: .5rem .7rem;
}
.staff-form input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.staff-form .active-field { min-height: 2.65rem; }
.no-script { padding: 1rem; text-align: center; }

@media (max-width: 44rem) {
  .topbar-content, .work-area { padding-inline: 1rem; }
  .topbar-content { flex-wrap: wrap; }
  .work-area { padding-top: 1.7rem; }
  .list-header { align-items: stretch; flex-direction: column; padding-inline: 1rem; }
  .filters input { min-width: 0; }
  .filters select { min-width: 7.45rem; width: auto; }
  th, td { padding-inline: .65rem; }
  th:first-child, td:first-child { padding-left: 1rem; }
  th:last-child, td:last-child { padding-right: 1rem; }
  .account { gap: .55rem; }
}
@media (max-width: 25rem) {
  .account-phone { display: none; }
  .filters { flex-wrap: wrap; }
  .filters select { width: 100%; }
  .drawer-content, .drawer-heading { padding-inline: 1rem; }
  .page-title h1 { font-size: 2rem; }
}
