:root {
  --bg: #1e1e1e;
  --bg-2: #252526;
  --bg-3: #2d2d30;
  --border: #3c3c3c;
  --text: #d4d4d4;
  --muted: #8b8b8b;
  --accent: #0e639c;
  --accent-hover: #1177bb;
  --green: #4ec9b0;
  --red: #f14c4c;
  --orange: #d7ba7d;
  --yellow: #dcdcaa;
  --blue: #569cd6;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }

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

button {
  background: var(--accent); color: #fff; border: 0; border-radius: 3px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--bg-3); border: 1px solid var(--border); color: var(--text); }
button.secondary:hover { background: #3a3a3d; }
button.danger { background: #a1260d; }
button.danger:hover { background: #c53a1c; }
button.small { padding: 4px 10px; font-size: 12px; }

input, select, textarea {
  background: #3c3c3c; color: var(--text); border: 1px solid #555; border-radius: 3px; padding: 7px 9px; font-size: 13px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }

.center { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 24px; width: 100%; max-width: 620px; }
.card h1 { margin: 0 0 4px; font-size: 20px; }
.card .sub { color: var(--muted); margin-bottom: 18px; }
.brand { color: var(--orange); font-weight: 700; letter-spacing: .04em; font-size: 12px; text-transform: uppercase; }
.error { color: var(--red); margin-top: 10px; min-height: 18px; font-size: 13px; }
.rules { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 12px 16px; margin: 14px 0; line-height: 1.55; }
.rules li { margin: 4px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.ide { display: grid; grid-template-rows: 40px 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; background: var(--bg-3); border-bottom: 1px solid var(--border); padding: 0 12px; }
.topbar .title { font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .status { color: var(--muted); font-size: 12px; }
.timer { font-family: "Cascadia Code", Consolas, monospace; font-size: 18px; padding: 3px 10px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); min-width: 84px; text-align: center; }
.timer.warn { color: var(--orange); border-color: var(--orange); }
.timer.critical { color: var(--red); border-color: var(--red); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }

.workspace { display: grid; grid-template-columns: 200px minmax(0, 1fr) 6px var(--side-width, 440px); min-height: 0; width: 100vw; max-width: 100vw; overflow: hidden; }
.workspace > * { min-width: 0; min-height: 0; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); overflow: auto; }
.sidebar h3 { margin: 0; padding: 6px 4px 6px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.sidebar h3 .tab-btn { font-size: 16px; padding: 0 8px; line-height: 1; }
.sidebar-help { padding: 12px; font-size: 11px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--border); margin-top: 8px; }
.sidebar-help code { font-family: Consolas, monospace; }
.file { padding: 6px 12px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-family: Consolas, monospace; font-size: 13px; }
.file:hover { background: #2a2d2e; }
.file.active { background: #37373d; }
.file .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .ro { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.file .del { color: var(--muted); padding: 0 2px; }
.file .del:hover { color: var(--red); }
.editor-column { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 35px minmax(0, 1fr) 6px var(--bottom-height, 220px); min-height: 0; min-width: 0; overflow: hidden; }
.editor-column > * { min-width: 0; }
.editor-column.collapsed { grid-template-rows: 35px minmax(0, 1fr) 6px 35px; }
.editor-column.collapsed .panel-body { display: none; }
.tabs { display: flex; align-items: stretch; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.tabs .spacer { flex: 1; }
.tab { padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border); white-space: nowrap; }
.tab.active { color: var(--text); background: var(--bg); }
.tab-btn { background: transparent; color: var(--muted); border: 0; padding: 0 12px; font-size: 14px; cursor: pointer; }
.tab-btn:hover { background: var(--bg-3); color: var(--text); }
#editor { min-height: 0; min-width: 0; overflow: hidden; position: relative; }
#editor .monaco-editor { max-width: 100%; }
.gutter-h { background: var(--border); cursor: row-resize; }
.gutter-v { background: var(--border); cursor: col-resize; }
.gutter-h:hover, .gutter-v:hover, body.resizing .gutter-h.active, body.resizing .gutter-v.active { background: var(--accent); }
body.resizing { cursor: inherit; user-select: none; }
body.resizing #editor { pointer-events: none; }
.panel { display: grid; grid-template-rows: 35px minmax(0, 1fr); min-height: 0; background: var(--bg); }
.side-panel { display: grid; grid-template-rows: 35px minmax(0, 1fr); min-height: 0; min-width: 0; overflow: hidden; background: var(--bg); border-left: 1px solid var(--border); position: relative; z-index: 2; }
.panel-body { overflow: auto; padding: 12px 16px; font-size: 13px; line-height: 1.55; }
.panel-body.statement { padding: 16px 22px; font-size: 13.5px; line-height: 1.65; }
.panel-body.statement h1 { font-size: 18px; margin: 4px 0 12px; }
.panel-body.statement h2 { font-size: 15px; margin: 18px 0 6px; color: var(--yellow); }
.panel-body.statement li { margin: 4px 0; }
.panel-body pre { background: var(--bg-2); padding: 10px 12px; border-radius: 4px; overflow: auto; font-family: Consolas, "Cascadia Code", monospace; font-size: 12.5px; }
.panel-body code { font-family: Consolas, monospace; background: var(--bg-2); padding: 1px 5px; border-radius: 3px; }
.panel-body h1, .panel-body h2, .panel-body h3 { margin: 12px 0 6px; }
.noselect { user-select: none; -webkit-user-select: none; }
.hidden { display: none !important; }

.test { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.test .ok { color: var(--green); }
.test .ko { color: var(--red); }
.test .msg { color: var(--muted); }
.hint-box { background: var(--bg-2); border-left: 3px solid var(--orange); padding: 10px 12px; margin: 8px 0; border-radius: 3px; }
.console { font-family: Consolas, monospace; white-space: pre-wrap; color: var(--text); }
.console.err { color: var(--red); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.badge.NONE { background: #2f4f3a; color: var(--green); }
.badge.LOW { background: #4a4525; color: var(--yellow); }
.badge.MEDIUM { background: #5a3f1a; color: var(--orange); }
.badge.HIGH { background: #5a1f1f; color: var(--red); }
.badge.status { background: var(--bg-3); color: var(--text); }
.badge.status.SUBMITTED, .badge.status.REVIEWED { background: #2f4f3a; color: var(--green); }
.badge.status.IN_PROGRESS { background: #1f3a5a; color: #9cdcfe; }
.badge.status.EXPIRED { background: #5a1f1f; color: var(--red); }

.admin { padding: 20px 28px; max-width: 1300px; margin: 0 auto; }
.admin header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.admin header .spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; background: var(--bg-2); border: 1px solid var(--border); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #2a2d2e; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: 10px 14px; }
.stat .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.section { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; }
.section h2 { margin: 0 0 12px; font-size: 15px; }
.timeline { max-height: 320px; overflow: auto; font-family: Consolas, monospace; font-size: 12px; }
.timeline div { padding: 3px 0; border-bottom: 1px solid var(--border); }
.timeline .t { color: var(--muted); margin-right: 10px; }
.timeline .warn { color: var(--orange); }
.timeline .bad { color: var(--red); }
.code-box { font-family: Consolas, monospace; font-size: 22px; letter-spacing: .12em; background: var(--bg); border: 1px dashed var(--orange); padding: 14px; text-align: center; border-radius: 6px; margin: 12px 0; user-select: all; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.viewer { display: grid; grid-template-columns: 220px 1fr; height: 460px; border: 1px solid var(--border); }
.viewer .sidebar { border-right: 1px solid var(--border); }
#admin-editor { min-height: 0; }
.reasons li { margin: 3px 0; }
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
