:root {
  --navy: #092b5b;
  --blue: #0c4da2;
  --blue-light: #eaf2ff;
  --ink: #17243a;
  --muted: #65748b;
  --line: #dbe3ef;
  --bg: #f3f6fa;
  --success-bg: #c6efce;
  --success: #006100;
  --warning-bg: #ffeb9c;
  --warning: #9c6500;
  --danger-bg: #ffc7ce;
  --danger: #9c0006;
  --shadow: 0 12px 32px rgba(32, 54, 88, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at top right, #dceaff, transparent 42%), linear-gradient(135deg, #f7faff, #e7eef8); }
.login-card { width: min(460px, 100%); padding: 44px; background: white; border-radius: 18px; box-shadow: 0 24px 70px rgba(8, 39, 82, .17); border-top: 6px solid var(--blue); }
.brand-mark { width: max-content; font-size: 34px; font-weight: 900; letter-spacing: 5px; color: var(--navy); }
.brand-mark::after { content: ""; display: block; width: 72%; border-bottom: 4px solid #3346ad; transform: skewX(-25deg); margin-top: -3px; }
.brand-mark.small { font-size: 22px; }
.login-card h1 { font-size: 25px; line-height: 1.25; margin: 28px 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 26px; }
label { display: grid; gap: 7px; color: #33435c; font-weight: 650; font-size: 13px; }
input, select { width: 100%; min-height: 42px; border: 1px solid #becadc; border-radius: 7px; padding: 9px 11px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(12, 77, 162, .12); }
.readonly { background: #edf1f6; color: #45556d; }
button { border: 0; border-radius: 7px; padding: 10px 17px; font-weight: 700; transition: .15s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary { color: white; background: var(--blue); box-shadow: 0 5px 13px rgba(12, 77, 162, .22); }
.secondary { color: var(--navy); background: white; border: 1px solid #bdc9da; }
.danger-outline { color: #9d1720; }
.login-card .primary { width: 100%; margin-top: 24px; min-height: 45px; }
.setup-link { width: 100%; margin-top: 15px; font-size: 12px; }
.settings-fields { display: grid; gap: 10px; margin-top: 22px; }
.path-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-bottom: 12px; }
.path-picker input { background: #edf1f6; }
#settingsContinue { width: 100%; margin-top: 20px; }
.form-error { color: var(--danger); min-height: 20px; margin-top: 12px; white-space: pre-line; font-size: 13px; font-weight: 650; }
.app-view { max-width: 1540px; margin: 0 auto; padding: 20px 25px 45px; }
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding: 2px 4px; }
.app-header h1 { margin: 7px 0 0; font-size: 23px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.user-chip { background: var(--blue-light); color: var(--navy); border-radius: 999px; padding: 10px 15px; font-weight: 700; }
.panel { background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 17px; padding: 18px 20px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.section-title > div { display: flex; align-items: center; gap: 10px; }
.section-title span:first-child { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 7px; background: var(--navy); color: white; font-size: 12px; font-weight: 800; }
.section-title h2 { font-size: 17px; margin: 0; }
.section-title.compact { margin: 0; }
.badge { border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 800; }
.badge.neutral { background: #e9edf3; color: #4e5d72; }
.badge.success { background: var(--success-bg); color: var(--success); }
.form-grid { display: grid; gap: 14px; }
.identification-grid { grid-template-columns: 1.1fr .65fr .65fr 1fr 1.2fr 1.55fr; }
.metrics-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.metrics-grid label { position: relative; }
.metrics-grid label small { position: absolute; right: 10px; bottom: 13px; color: var(--muted); font-weight: 700; }
.metrics-grid input { padding-right: 66px; }
.production-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; }
.detail-actions { display: grid; gap: 9px; }
.detail-button { text-align: left; background: #f7f9fc; color: var(--navy); border: 1px solid #cdd7e5; padding: 13px 15px; }
.detail-button strong, .detail-button span { display: block; }
.detail-button span { color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 500; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 10px; margin-top: 16px; }
.control { min-height: 45px; display: grid; place-items: center; text-align: center; padding: 9px; border-radius: 7px; font-weight: 750; font-size: 13px; }
.neutral { background: #e6e9ee; color: #404b5b; }
.success { background: var(--success-bg); color: var(--success); }
.warning { background: var(--warning-bg); color: var(--warning); }
.danger { background: var(--danger-bg); color: var(--danger); }
.save-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.large { min-width: 180px; min-height: 44px; }
.message { min-height: 20px; text-align: right; margin-top: 8px; font-weight: 700; font-size: 13px; white-space: pre-line; }
.coverage-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 14px; }
.coverage-heading p { color: var(--muted); margin: 6px 0 0 39px; font-size: 13px; }
.summary-chips { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.summary-chip { padding: 8px 11px; border-radius: 7px; background: #eef2f7; font-size: 12px; font-weight: 800; }
.table-wrap { overflow: auto; max-height: 330px; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead { position: sticky; top: 0; z-index: 1; }
th { text-align: left; background: var(--navy); color: white; padding: 10px 9px; white-space: nowrap; }
td { border-bottom: 1px solid #e3e8f0; padding: 9px; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover td { filter: brightness(.97); }
tr.row-missing td { background: #fff0f1; color: #7e2026; }
tr.row-entered td { background: #f2fbf4; }
tr.row-pending td { background: #fff8df; color: #755300; }
.production-help { margin:-4px 0 17px; line-height:1.6; }
.status-pill { border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 900; }
.status-entered { background: var(--success-bg); color: var(--success); }
.status-missing { background: var(--danger-bg); color: var(--danger); }
.table-help { color: var(--muted); font-size: 12px; margin: 9px 0 0; }
dialog { width: min(940px, calc(100vw - 40px)); border: 0; border-radius: 13px; padding: 0; box-shadow: 0 30px 100px rgba(10, 31, 62, .35); }
dialog::backdrop { background: rgba(9, 24, 47, .55); }
.dialog-card { padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.dialog-heading h2 { margin: 0; }
.dialog-heading p { margin: 5px 0 0; color: var(--muted); }
.icon-button { font-size: 27px; line-height: 1; background: transparent; color: var(--muted); padding: 2px 8px; }
.detail-rows { display: grid; gap: 10px; padding: 18px 0 5px; }
.detail-row { display: grid; gap: 10px; grid-template-columns: 34px 105px minmax(0,1fr) minmax(0,1fr) auto; align-items: end; }
.detail-row.nc { grid-template-columns: 34px 105px minmax(0,1fr) minmax(0,1fr) auto; }
.detail-row.waste { grid-template-columns: 34px 145px minmax(0,1fr) auto; }
.detail-search { display:flex; gap:5px; align-items:center; margin-top:7px; min-width:0; }
.detail-search input { flex:1; min-width:0; width:0; }
.detail-other { padding:9px 8px; font-size:12px; flex-shrink:0; }
.detail-delete { padding:10px 8px; color:#9c0006; background:#fce8e8; border:1px solid #edc7c7; font-size:12px; }
.row-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-light); color: var(--blue); font-weight: 900; margin-bottom: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.shift-settings { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 12px; }
.shift-grid { grid-template-columns: repeat(3, 1fr); }
.detail-row.stop { grid-template-columns:34px minmax(0,1fr) auto; align-items:start; border:1px solid var(--line); border-radius:10px; padding:14px; background:#f8fafd; }
.detail-row.stop .row-number { margin-top:3px; }
.stop-fields { min-width:0; }
.stop-choice-grid { grid-template-columns:1fr 1.4fr; margin-bottom:12px; }
.stop-time-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.stop-time-grid label { display:block; }
.stop-time-grid label small { color:var(--muted); font-size:11px; font-weight:500; }
.stop-time-grid input { display:block; margin-top:7px; }
.stop-time-hint { min-height:16px; line-height:1.5; }
#detailDialog { max-height:calc(100vh - 40px); overflow-y:auto; }
#adminManagerDialog { width:min(1440px,calc(100vw - 28px)); max-height:calc(100vh - 28px); background:var(--bg); overflow-y:auto; }
.admin-page { padding:22px 24px 8px; }
.admin-header { gap:18px; }
.admin-header .header-actions { flex-wrap:wrap; justify-content:flex-end; }
.admin-toolbar { display:flex; gap:12px; align-items:end; }
.admin-toolbar label { flex:1; }
.admin-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-top:18px; }
.admin-check { display:flex; align-items:center; gap:12px; min-height:70px; padding:14px; background:var(--blue-light); border-radius:8px; }
.admin-check input { width:21px; height:21px; min-height:21px; margin:0; padding:0; accent-color:var(--blue); flex-shrink:0; }
.admin-check span { display:grid; gap:4px; }
.admin-check small { font-weight:500; color:var(--muted); }
.admin-list-actions { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.admin-list-actions p { margin:0; }
.admin-table { max-height:330px; }
.admin-selected td { background:var(--blue-light); }
.admin-selected td:first-child { box-shadow:inset 3px 0 var(--blue); }
.admin-inactive td { color:var(--muted); }
.admin-editor .message { text-align:left; }
.admin-row-status { display:inline-block; }
.presence-panel { margin-top:16px; }
#reservationMessage { text-align:left; }
#choiceDialog { width:min(600px,calc(100vw - 40px)); }
#adminGateDialog { width: min(460px, calc(100vw - 40px)); }
@media (max-width: 1150px) {
  .identification-grid { grid-template-columns: repeat(3, 1fr); }
  .production-layout { grid-template-columns: 1fr; }
  .detail-actions { grid-template-columns: repeat(3, 1fr); }
  .control-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .admin-page { padding:16px 12px 4px; }
  .admin-header, .admin-toolbar { flex-wrap:wrap; }
  .admin-toolbar label { flex:1 1 100%; }
  .admin-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .admin-list-panel .coverage-heading { align-items:start; flex-direction:column; gap:10px; }
  .stop-choice-grid { grid-template-columns:1fr; }
  .stop-time-grid { grid-template-columns:1fr; }
  .detail-row.nc, .detail-row.waste { grid-template-columns:34px minmax(0,1fr); align-items:start; border:1px solid var(--line); border-radius:10px; padding:12px; }
  .detail-row.nc label, .detail-row.waste label { grid-column:2; }
  .detail-row.nc .detail-delete, .detail-row.waste .detail-delete { grid-column:2; justify-self:start; }
  .detail-row.stop { grid-template-columns:34px minmax(0,1fr); }
  .detail-row.stop .detail-delete { grid-column:2; justify-self:start; }
}
