:root {
  color-scheme: light;
  --green: #22c55e;
  --green-dark: #13823f;
  --ink: #102018;
  --muted: #607068;
  --line: #d8e2dc;
  --soft: #f2f7f4;
  --danger: #a32626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(5, 31, 18, 0.2), rgba(5, 31, 18, 0.48)),
    url("/rail-background.jpg") center center / cover fixed no-repeat,
    #eef7f0;
}

header {
  width: min(1280px, calc(100% - 32px));
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 24px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(3px);
}
header img {
  width: min(360px, 70vw);
  height: 64px;
  object-fit: contain;
  object-position: center;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(5, 31, 18, 0.82);
}
header div { display: flex; align-items: center; gap: 14px; color: var(--muted); }

main {
  width: min(1280px, calc(100% - 32px));
  margin: 18px auto 24px;
  padding: 28px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(3px);
  box-shadow: 0 24px 70px rgba(5, 31, 18, 0.2);
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; color: var(--green); }
h2 { font-size: 20px; }
p { color: var(--muted); line-height: 1.5; }

#adminView .page-heading h1 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
  color: var(--green-dark);
}

.back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-bottom: 16px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--green-dark);
  background: #fff;
  font-weight: 800;
  text-decoration: none;
}

.auth-layout { display: grid; gap: 30px; }
.auth-intro { text-align: center; }
.auth-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 920px; margin: 0 auto; width: 100%; }
form { border: 1px solid var(--line); padding: 24px; display: grid; gap: 16px; border-radius: 6px; }
label { display: grid; gap: 7px; font-weight: 700; color: #32453a; }
input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #b7c8be;
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
}
input:focus { outline: 3px solid #ccebd8; border-color: var(--green); }

button, .pdf-link {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  padding: 10px 16px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .pdf-link:hover { background: var(--green-dark); }
button.secondary { background: #edf3ef; color: var(--green-dark); }
button.danger { background: var(--danger); }
button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; margin: 2px; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.order-workspace {
  margin-bottom: 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}
.fetch-form {
  grid-template-columns: minmax(220px, 1fr) minmax(190px, 280px) auto;
  align-items: end;
  padding: 0;
  border: 0;
}
.fetch-form button { min-height: 46px; }
.fetched-order {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #b7c8be;
  border-radius: 6px;
  background: #fff;
}
.fetched-order h2 { color: var(--green); }
.order-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.order-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.order-summary div { padding: 10px; background: var(--soft); }
.order-summary strong { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 8px; margin: 18px 0; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; color: var(--muted); border-radius: 0; }
.tabs button.active { color: var(--green); border-bottom: 3px solid var(--green); }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); color: #415349; font-size: 13px; }
td { font-size: 14px; }
.status { font-weight: 800; color: var(--green); }
.status.pending { color: #9a6600; }
.status.blocked, .status.rejected { color: var(--danger); }

.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px solid var(--line); }
.message { position: fixed; right: 18px; bottom: 18px; max-width: 440px; padding: 14px 16px; color: #fff; background: var(--green-dark); border-radius: 4px; }
.message.error { background: var(--danger); }
.hidden { display: none !important; }
footer { text-align: center; padding: 22px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }
footer {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}
footer span {
  display: block;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .auth-panels { grid-template-columns: 1fr; }
  .page-heading { flex-direction: column; }
  header { align-items: flex-start; flex-direction: column; }
  .fetch-form, .order-summary { grid-template-columns: 1fr; }
}
