:root {
  --ink: #172b3d;
  --muted: #5e7183;
  --line: #d7e1ea;
  --bg: #f4f7fa;
  --card: #ffffff;
  --blue: #1f5f8f;
  --green: #16734b;
  --red: #b3261e;
  --amber: #8a5a00;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
.hidden { display: none !important; }
button, input, select { font: inherit; }
.btn { border: 1px solid #b9c8d7; border-radius: 8px; background: #fff; color: var(--ink); padding: 8px 13px; cursor: pointer; font-weight: 600; }
.btn:hover { background: #eef4f9; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #194e74; }
.btn.danger { color: var(--red); border-color: #e4b5b1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 4px; text-decoration: underline; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #123354, #1f4e78); }
.auth-card { width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 13px; background: #fff; padding: 30px; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.28); }
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-mark, .brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--blue); color: #fff; font-weight: 800; letter-spacing: .5px; }
.auth-card .muted { margin: -6px 0 6px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: #41546a; }
.field input, .field select { border: 1px solid #c9d6e2; border-radius: 7px; padding: 9px 10px; background: #fff; color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 7px; color: #41546a; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.brand-mark { width: 34px; height: 34px; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; background: #e8f0f7; color: #274b68; font-size: 12px; font-weight: 700; }
.badge.admin { background: #e7f5ed; color: var(--green); }
.badge.planner { background: #fff4db; color: var(--amber); }
.badge.viewer { background: #eef1f4; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 0 22px; background: #fff; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 12px 15px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
main { padding: 22px; max-width: 1500px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-head h2, .page-head h3 { margin: 0 0 4px; }
.muted { color: var(--muted); margin: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; }
.summary-card span { display: block; color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; margin-top: 4px; font-size: 15px; word-break: break-word; }
.card, .table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #e7edf3; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: 0; }
.right { text-align: right; }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
.admin-grid .card { display: flex; flex-direction: column; gap: 10px; }
.hint { color: var(--muted); font-weight: 400; }
.engine-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.engine-controls .field { min-width: 260px; }
.engine-frame { width: 100%; height: 900px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.notice { background: #eaf3fb; border: 1px solid #c5dcf0; color: #234f70; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.notice.error { background: #fdecea; border-color: #f0c4c0; color: var(--red); }
.notice.success { background: #e8f6ee; border-color: #bfe3cc; color: var(--green); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 440px; background: #172b3d; color: #fff; border-radius: 9px; padding: 12px 15px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } .engine-frame { height: 680px; } }
