:root {
  --bg: #FAF9F5; --panel: #FFFFFF; --soft: #F0EEE6; --line: #E4E1D6; --text: #141413; --muted: #6B6960;
  --yellow: #FFD829; --gold: #8A6A00; --green: #2F7D32; --orange: #A85A0A; --red: #B3401F;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.2; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.shell { display: flex; min-height: 100vh; }
.nav { flex: 0 0 230px; padding: 24px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 600; line-height: 1.15; }
.brand img { width: 36px; height: 36px; padding: 5px; object-fit: contain; background: var(--text); border-radius: 8px; }
.brand span span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.nav a, .nav button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--soft); }
.nav a.on { background: var(--soft); font-weight: 600; }
.nav .out { margin-top: auto; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 32px 40px 48px; }
.narrow { max-width: 720px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; font: inherit; font-size: 15px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

button.btn { min-height: 42px; padding: 0 16px; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
button.btn:hover { background: var(--soft); }
button.primary { background: var(--yellow); border-color: var(--yellow); font-weight: 600; }
button.primary:hover { background: #F2CC1F; }
button.on { border-color: var(--gold); color: var(--gold); font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
button.icon { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; padding: 0 12px; }
button.danger { color: var(--red); }
.version-select { width: auto; max-width: 100%; }
.script-edit { font-size: 16px; line-height: 1.6; }
.notes { white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.title-box { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.title-box h1 { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.title-form { flex: 1; }
.title-form input { flex: 1 1 280px; width: auto; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.error { color: var(--red); font-size: 14px; }
.ok { color: var(--green); font-size: 14px; }

details.more { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
details.more summary { padding: 16px 22px; cursor: pointer; font-weight: 600; }
details.more .inner { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.changed { color: var(--gold); font-weight: 600; }
.fileline { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.fileline audio { height: 34px; max-width: 240px; }

.board { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 8px; align-items: start; overflow-x: auto; margin-top: 20px; padding-bottom: 8px; }
.column { background: var(--soft); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 180px; min-width: 0; }
.column h2 { font-size: 13px; display: flex; justify-content: space-between; gap: 6px; padding: 2px 4px; }
.task { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; font-size: 14px; }
.task:hover { border-color: var(--gold); }
.task .code { font-size: 12px; font-weight: 600; color: var(--gold); overflow-wrap: anywhere; }
.task .name { font-weight: 600; overflow-wrap: anywhere; }
.task .edits-count { font-size: 13px; font-weight: 600; color: var(--orange); }

.review { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; margin-top: 20px; }
.script { font-size: 17px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
del { color: var(--red); }
ins { color: #1E5A22; background: #DDEFD8; text-decoration: none; border-radius: 3px; }
.edit { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.params { display: grid; gap: 4px; font-size: 14px; }

.btn-link { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; background: var(--yellow); border-radius: 6px; }
.decide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.decide .btn { padding: 0 8px; }
.btn-link:hover { background: #F2CC1F; }
.rule { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.rule p { min-width: 0; overflow-wrap: anywhere; }
.rule-actions { flex: none; flex-wrap: nowrap; gap: 6px; }
.rule-actions button { min-height: 36px; min-width: 36px; padding: 0 8px; }
.filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 20px 0 8px; }
.filters + .small:empty { display: none; }
.board { margin-top: 12px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav { flex: none; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .brand { width: 100%; padding-bottom: 8px; }
  .nav a, .nav button { width: auto; }
  .nav .out { margin: 0; }
  .main { padding: 20px 16px 36px; }
  .grid, .review, .filters { grid-template-columns: minmax(0, 1fr); }
}
