/* Radcal File Exchange — customer-facing styles.
   Brand: iba green #69BE28, charcoal #323031 (from Logo_IBA_Radcal).
   Hand-written, no build step. Filament ships its own CSS for /admin. */

:root {
  --brand: #69be28;
  --brand-ink: #4f9418;
  --brand-dark: #3d7412;
  --brand-soft: #eef7e4;
  --brand-line: #cfe8b6;

  --ink: #323031;
  --ink-2: #55545a;
  --ink-3: #86858c;
  --ink-inv: #ffffff;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --sidebar: #ffffff;
  --border: #e4e5e9;
  --border-2: #d3d5da;

  --good: #2f7d3f;
  --good-soft: #e6f2e6;
  --warn: #8a5a00;
  --warn-soft: #fbf0dc;
  --danger: #b3271b;
  --danger-soft: #f7e4e2;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .06);
  --shadow: 0 1px 3px rgba(24, 24, 27, .07), 0 8px 24px rgba(24, 24, 27, .06);

  --sidebar-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-ink); }
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }

/* =====================================================================
   Public / auth pages (home, send, access, password prompt)
   ===================================================================== */
.auth {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(2rem, 8vh, 6rem) 1.25rem 3rem;
}
.auth-brand { margin-bottom: 2rem; }
.auth-brand img { height: 46px; width: auto; display: block; }

.auth-inner { width: 100%; max-width: 27rem; }
.auth-inner.lg { max-width: 34rem; }
/* Full-width pages (shared files list): fill the screen, side padding comes from .auth. */
.auth-inner.xl { max-width: none; }

.auth h1 { font-size: 1.5rem; margin: 0 0 .35rem; text-wrap: balance; }
.auth .sub { color: var(--ink-2); margin: 0 0 1.5rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
}

.choice-grid {
  display: grid;
  gap: .9rem;
  grid-template-columns: 1fr;
}
.choice {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.choice:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.choice .ic {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.choice h2 { font-size: 1rem; margin: .1rem 0 .15rem; }
.choice p { margin: 0; color: var(--ink-2); font-size: .9rem; }

.auth-foot {
  margin-top: 2rem;
  font-size: .82rem;
  color: var(--ink-3);
  text-align: center;
  max-width: 27rem;
}

/* =====================================================================
   Forms
   ===================================================================== */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .35rem; }
.field .hint { font-weight: 400; color: var(--ink-3); }

input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { min-height: 6rem; resize: vertical; }

.code-input {
  letter-spacing: .55em;
  font-size: 1.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-left: .55em;
}

.error-text { color: var(--danger); font-size: .83rem; margin-top: .35rem; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .62rem 1.05rem;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--brand-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border-2); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #e6b3ad; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: .42rem .7rem; font-size: .82rem; }
.btn.link { background: none; border: none; color: var(--brand-ink); padding: .35rem .2rem; font-weight: 600; }
.btn.link:hover { color: var(--brand-dark); text-decoration: underline; background: none; }
.btn.block { width: 100%; }

.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1.2rem; }

/* =====================================================================
   Alerts
   ===================================================================== */
.alert {
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  font-size: .88rem;
  margin-bottom: 1.1rem;
  border: 1px solid transparent;
}
.alert.info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); }
.alert.success { background: var(--good-soft); border-color: #bfe0c3; color: var(--good); }
.alert.error { background: var(--danger-soft); border-color: #e6bcb7; color: var(--danger); }

.notice {
  border: 1px solid var(--warn-soft);
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .87rem;
}

/* =====================================================================
   Dashboard shell (exchange workspace)
   ===================================================================== */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img { height: 30px; width: auto; display: block; }

.sidebar-nav {
  padding: .85rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1;
}
.nav-heading {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  padding: .9rem .8rem .35rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-2);
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex: none; color: var(--ink-3); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.nav-item.is-active svg { color: var(--brand-ink); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-item .tag {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-3);
  border-radius: 999px;
  padding: .05rem .45rem;
  min-width: 1.4rem;
  text-align: center;
}
.nav-item.is-active .tag { background: #fff; color: var(--brand-ink); }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 1rem 1.15rem;
  font-size: .8rem;
  color: var(--ink-3);
}
.sidebar-foot .exp { color: var(--ink-2); font-weight: 600; display: block; margin-top: .15rem; }
.sidebar-foot form { margin-top: .7rem; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem clamp(1.25rem, 4vw, 2.25rem);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.topbar .spacer { flex: 1; }
.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .28rem .7rem;
}
.ref-chip b { color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: .24rem .6rem;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.active { background: var(--good-soft); color: var(--good); }
.status-pill.warn { background: var(--warn-soft); color: var(--warn); }

.content {
  padding: clamp(1.25rem, 4vw, 2.25rem);
  max-width: 60rem;
  width: 100%;
}
.content > section { margin-bottom: 1.4rem; }
.content h2 { font-size: 1rem; margin: 0 0 .8rem; }

/* stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: .8rem;
  margin-bottom: 1.4rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .95rem 1.05rem;
  box-shadow: var(--shadow-sm);
}
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.stat .v { font-size: 1.25rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .8rem; font-weight: 500; color: var(--ink-3); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  padding: .95rem 1.15rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.card-head h2 { margin: 0; font-size: .95rem; }
.card-head .count { color: var(--ink-3); font-weight: 500; font-size: .82rem; }
.card-head .spacer { flex: 1; }
.card-body { padding: 1.15rem; }
.card-note { padding: .7rem 1.15rem; background: var(--surface-2); color: var(--ink-3); font-size: .8rem; border-top: 1px solid var(--border); }

/* definition list for exchange details */
.dl { display: grid; grid-template-columns: 1fr; }
.dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.dl > div:last-child { border-bottom: 0; }
.dl dt { color: var(--ink-3); font-size: .85rem; }
.dl dd { margin: 0; font-weight: 600; text-align: right; }
.dl dd .ref-number { font-variant-numeric: tabular-nums; letter-spacing: .03em; }

/* tables */
.table-wrap { overflow-x: auto; }
table.files { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.files th, table.files td { text-align: left; padding: .7rem 1.15rem; border-bottom: 1px solid var(--border); }
table.files thead th {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 600; background: var(--surface-2);
}
table.files tbody tr:last-child td { border-bottom: 0; }
table.files tbody tr:hover { background: var(--surface-2); }
table.files td.size { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
table.files td.right, table.files th.right { text-align: right; }
table.files td.check { width: 1rem; }
table.files .fname { display: flex; align-items: center; gap: .55rem; }
table.files .fname svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.empty-row td { text-align: center; color: var(--ink-3); padding: 2rem 1rem; }

input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--brand); }

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: var(--surface-2);
}
.dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { width: 22px; height: 22px; color: var(--ink-3); }
.dropzone .dz-title { font-weight: 600; margin: .4rem 0 .1rem; }
.dropzone .dz-hint { font-size: .82rem; color: var(--ink-3); }
.dropzone-outer { position: relative; }
.dropzone-outer > input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.pending-list { list-style: none; margin: .9rem 0 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: .3rem; }
.pending-list li { font-size: .85rem; display: flex; align-items: center; gap: .5rem; color: var(--ink-2); }
.pending-list li svg { width: 14px; height: 14px; color: var(--brand-ink); }

/* toast */
.toast {
  position: fixed;
  right: 1.25rem; bottom: 1.25rem;
  background: var(--ink);
  color: #fff;
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  box-shadow: var(--shadow);
  z-index: 50;
}

.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: .3rem;
    padding: .6rem .8rem;
  }
  .nav-heading, .nav-item .tag { display: none; }
  .nav-item { white-space: nowrap; }
  .nav-item.is-active::before { display: none; }
  .sidebar-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
