:root {
  color-scheme: light;
  font-family: Tajawal, "Segoe UI", Tahoma, sans-serif;
  color: #192d35;
  background: #f2f5f4;
  --ink: #173941;
  --accent: #086555;
  --border: #d3dfdc;
  --muted: #495f63;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
.masthead { background: var(--ink); color: white; }
.masthead-inner { max-width: 1180px; margin: auto; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; }
.brand { font-size: 1.5rem; font-weight: 800; }
.masthead .quiet { margin-inline-start: .65rem; background: transparent; color: white; border-color: #779397; }
main { max-width: 1180px; margin: auto; padding: 1.5rem; }
nav { display: flex; gap: .35rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
nav button { color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 0; }
nav button[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
h1 { font-size: clamp(1.8rem, 3vw, 2.35rem); margin: 0 0 1rem; line-height: 1.2; }
h2 { margin: 0 0 .85rem; font-size: 1.35rem; }
p { margin-bottom: 0; }
.panel { background: white; border: 1px solid var(--border); padding: clamp(1rem, 3vw, 1.6rem); border-radius: 12px; }
.login-card { max-width: 420px; margin: clamp(2rem, 10vh, 7rem) auto; }
.login-card button { width: 100%; }
.form-panel { max-width: 790px; }
.history-panel { margin-top: 1rem; }
.admin-grid, .field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(235px, 100%), 1fr)); gap: 1rem; }
form, label { display: grid; gap: .4rem; }
form { gap: 1rem; }
label { font-weight: 700; }
small { color: var(--muted); font-weight: 500; }
input, select, textarea, button { font: inherit; }
input, select, textarea { min-width: 0; width: 100%; padding: .62rem .7rem; background: white; color: inherit; border: 1px solid #aebfbe; border-radius: 7px; }
textarea { resize: vertical; }
button { cursor: pointer; padding: .57rem .9rem; min-height: 40px; background: var(--accent); color: white; border: 1px solid transparent; border-radius: 7px; font-weight: 800; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #508fc4; outline-offset: 2px; }
.quiet { background: white; color: var(--accent); border-color: var(--border); }
.danger { background: #952e35; }
.check { display: flex; align-items: center; }
.check input { width: auto; accent-color: var(--accent); }
.filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: .75rem; }
.advanced { grid-column: 1 / -1; }
summary { cursor: pointer; color: var(--accent); margin-bottom: .6rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: .55rem; }
th, td { text-align: start; padding: .7rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); white-space: nowrap; }
.row-link { direction: ltr; background: transparent; color: var(--accent); padding: .35rem; }
.badge { display: inline-block; white-space: nowrap; padding: .18rem .55rem; border-radius: 6px; background: #e8eff0; }
.badge.RECEIVED { background: #def2e8; color: #105642; }
.badge.PENDING_RECEIPT { background: #fff2d7; color: #754810; }
.badge.SEND_FAILED, .badge.CANCELLED { background: #f9e7e8; color: #8d292e; }
.upload { padding: .9rem; background: #f4f8f7; border: 1px dashed #91aaa5; border-radius: 8px; }
.actions, .section-head { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.section-head { justify-content: space-between; }
dl { display: grid; grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); gap: .45rem 1rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.summary { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; }
.summary div { background: white; border: 1px solid var(--border); border-radius: 8px; padding: .55rem .85rem; min-width: 8rem; }
.summary dd { font-size: 1.4rem; font-weight: 800; color: var(--accent); }
li { margin-block: .35rem; }
a { color: var(--accent); font-weight: 700; }
#detail h1, #action-form, #detail-link:not(:empty), #older, #audit-older { margin-top: 1rem; }
#feedback { padding: .7rem 1rem; margin-bottom: 1rem; background: #def2e8; border-radius: 7px; }
#feedback.error { background: #f9e7e8; color: #8d292e; }
@media (max-width: 700px) {
  main, .masthead-inner { padding-inline: .85rem; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > label:first-child { grid-column: 1 / -1; }
}
