:root {
  --blue: #6495ed;
  --blue-dark: #2c5fb3;
  --green: #1b7a32;
  --ink: #1c2430;
  --paper: #f7f8fb;
  --card: #ffffff;
  --line: #d5dbe6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 17px/1.5 "Segoe UI", Calibri, "Helvetica Neue", sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--blue);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.brand img { height: 48px; width: auto; background: white; }

nav { display: flex; align-items: center; gap: 16px; }

nav a, .nav-logout button {
  color: white;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

main { max-width: 980px; margin: 0 auto; padding: 28px 20px 64px; }
main.wide { max-width: 1240px; }

h1 { margin: 0 0 12px; font-size: 34px; }
h2 { color: var(--green); font-size: 24px; margin: 28px 0 8px; }

.lead { font-size: 19px; }

a { color: var(--blue-dark); }

.button, button[type="submit"] {
  display: inline-block;
  margin: 8px 8px 8px 0;
  padding: 10px 16px;
  background: var(--blue-dark);
  color: white;
  text-decoration: none;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary { background: #4d607a; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin: 12px 0;
}

label { display: block; margin: 12px 0; font-weight: 600; }

input[type="text"], input[type="email"], input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid #b7c0d0;
  border-radius: 4px;
}

input[type="file"] { display: block; margin-top: 6px; font: inherit; }

.check { font-weight: 600; }
.check input { margin-right: 8px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
}

.hint, .aside, .job-note { color: #3d4a5c; }

.quota { font-size: 18px; }

.flashes p {
  background: #fff6d8;
  border: 1px solid #e2c56a;
  padding: 10px 12px;
  border-radius: 6px;
}

.jobs { list-style: none; padding: 0; }
.jobs li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.jobs span { display: block; color: #3d4a5c; font-size: 15px; }

.panels figure {
  margin: 18px 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.panels figcaption { font-weight: 700; color: var(--green); margin-bottom: 8px; }
.panels img { max-width: 100%; height: auto; background: white; }

.section-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 8px 0 10px;
}

.section-group { display: flex; flex-wrap: wrap; }

.section-group button, .section-tool {
  margin: 0;
  padding: 8px 12px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.section-group button + button { margin-left: -1px; }
.section-group button:first-child { border-radius: 6px 0 0 6px; }
.section-group button:last-child { border-radius: 0 6px 6px 0; }
.section-group button:only-child { border-radius: 6px; }

.section-group button[aria-pressed="true"] {
  background: var(--blue-dark);
  color: white;
  border-color: var(--blue-dark);
  position: relative;
  z-index: 1;
}

.section-group button:disabled {
  opacity: 0.45;
  cursor: default;
}

.section-tool { border-radius: 6px; }

.section-gain {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
}

.section-gain input { width: 140px; margin: 0; }

.section-readout {
  color: #3d4a5c;
  font-variant-numeric: tabular-nums;
}

.section-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  grid-template-rows: 680px 28px;
  gap: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

#section-canvas {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  cursor: crosshair;
  touch-action: none;
  background: white;
}

#section-canvas:focus { outline: 2px solid var(--blue); outline-offset: -2px; }

.section-y-slot {
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
}

#section-y {
  writing-mode: vertical-lr;
  direction: ltr;
  width: 22px;
  height: 100%;
  margin: 0;
  accent-color: var(--blue-dark);
}

#section-x {
  grid-column: 1;
  grid-row: 2;
  direction: ltr;
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: var(--blue-dark);
}

@media (max-width: 700px) {
  .section-stage { grid-template-rows: 480px 28px; }
}

.limit-note h2 { margin-top: 0; }

footer {
  border-top: 1px solid var(--line);
  padding: 16px 24px 28px;
  color: #3d4a5c;
}

footer a { color: var(--blue-dark); }

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-bar h1 { margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}

.stat-grid h2 { margin: 0 0 6px; font-size: 16px; color: #3d4a5c; }

.table-wrap { overflow-x: auto; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: 15px;
}

table.tbl th, table.tbl td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.tbl th { color: #3d4a5c; font-weight: 700; }

.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .admin-split { grid-template-columns: 1fr; }
}
