/* RCC Import Orders — brand colours: red, blue, white */
:root {
  --red: #D7141E;
  --red-dark: #B00F18;
  --blue: #0A3D8F;
  --blue-dark: #072B66;
  --blue-soft: #E8EEF9;
  --white: #FFFFFF;
  --bg: #F3F5F9;
  --text: #17202F;
  --muted: #667085;
  --border: #DFE4EC;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45;
}
body.modal-open { overflow: hidden; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar { background: var(--white); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 var(--border); }
.topbar-inner { max-width: 1500px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stripe { height: 4px; background: linear-gradient(90deg, var(--red) 0 50%, var(--blue) 50% 100%); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { height: 44px; width: auto; display: block; }
.brand-name { font-weight: 700; font-size: 17px; color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12.5px; color: var(--red); font-weight: 600; letter-spacing: .02em; }

.wrap { max-width: 1500px; margin: 0 auto; padding: 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-dark); }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover { background: var(--blue-dark); }
.btn-outline { background: var(--white); color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: var(--blue-soft); }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--blue); }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; transition: opacity .4s; }
.alert-success { background: #E7F6EC; color: #116329; border: 1px solid #B7E3C4; }
.alert-error { background: #FDECEC; color: var(--red-dark); border: 1px solid #F5C2C4; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--blue); }
.stat:first-child { border-top-color: var(--red); }
.stat-num { display: block; font-size: 24px; font-weight: 700; color: var(--blue); }
.stat-label { color: var(--muted); font-size: 12.5px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.search { flex: 1; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.search input {
  width: 100%; padding: 10px 12px 10px 38px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: var(--white); color: var(--text);
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

/* ---------- Table ---------- */
.table-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.orders { width: 100%; border-collapse: collapse; min-width: 1250px; }
.orders th {
  background: var(--blue); color: var(--white); text-align: left; font-weight: 600; font-size: 12.5px;
  padding: 11px 12px; white-space: nowrap; position: sticky; top: 0;
}
.orders td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.orders tbody tr:nth-child(even) td { background: #FAFBFD; }
.orders tbody tr:hover td { background: var(--blue-soft); }
.orders td.num { color: var(--muted); }
.orders td.strong { font-weight: 700; color: var(--blue); }
.orders tr.empty td { text-align: center; color: var(--muted); padding: 34px 12px; white-space: normal; }
.dash { color: #B4BBC8; }
.col-actions { text-align: right; }

.file-link { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; max-width: 210px; }
.file-ico { background: #1D7044; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 4px; flex: none; }
.file-name { overflow: hidden; text-overflow: ellipsis; }
.file-link:hover .file-name { text-decoration: underline; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.st-pending { background: #FFF4DB; color: #8A5A00; }
.st-quote-received { background: #E0F0FF; color: #0B5CAD; }
.st-confirmed { background: var(--blue-soft); color: var(--blue); }
.st-shipped { background: #EDE7FB; color: #5B3BB0; }
.st-delivered { background: #E3F5E9; color: #146C32; }
.st-cancelled { background: #FDE8E9; color: var(--red-dark); }

.actions { display: inline-flex; gap: 6px; align-items: center; }
.actions form { margin: 0; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--white); color: var(--blue);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { border-color: var(--blue); background: var(--blue-soft); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { border-color: var(--red); background: #FDECEC; }
.table-foot { padding: 10px 14px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }

/* ---------- Forms & modals ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
label input, label select {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; font-weight: 400; background: var(--white); color: var(--text);
}
label input[type=file] { padding: 8px; background: #FAFBFD; }
label input:focus, label select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
label small { display: block; font-weight: 400; margin-top: 5px; }
.req { color: var(--red); }

.modal { position: fixed; inset: 0; background: rgba(7, 20, 45, .55); display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal.open { display: flex; }
.modal-card { background: var(--white); border-radius: 12px; width: 100%; max-width: 480px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); border-top: 4px solid var(--red); }
.modal-card.wide { max-width: 720px; border-top-color: var(--blue); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; color: var(--blue); }
.close { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.close:hover { color: var(--red); }
.modal form { padding: 18px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0 16px; border-top: 1px solid var(--border); margin-top: 6px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.file-box { background: var(--blue-soft); border-radius: 8px; padding: 12px 14px 2px; margin-bottom: 12px; }
.file-box > div { margin-bottom: 10px; word-break: break-all; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue-dark) 100%); }
.login-card { background: var(--white); width: 100%; max-width: 380px; border-radius: 14px; padding: 30px 28px 26px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); position: relative; overflow: hidden; }
.login-card .stripe { position: absolute; top: 0; left: 0; right: 0; }
.login-logo { height: 60px; margin: 6px auto 10px; display: block; }
.login-card h1 { font-size: 18px; color: var(--blue); margin: 4px 0 2px; }
.login-card p { margin: 0 0 20px; }
.login-card form { text-align: left; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .toolbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 14px 12px; }
  .topbar-inner { padding: 10px 12px; }
  .logo { height: 34px; }
  .brand-name { font-size: 14.5px; }
  .toolbar .btn { flex: 1; }
  .grid { grid-template-columns: 1fr; }
  .modal { padding: 16px 10px; }
}
