* { box-sizing: border-box; }
body { font-family: -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; background: #f5f6f8; color: #222; }
header { background: #2c3e50; color: #fff; padding: 16px 24px; }
header h1 { margin: 0; font-size: 20px; font-weight: 600; }
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.header-user { font-size: 13px; color: #cfd5dc; display: flex; align-items: center; gap: 10px; }
.link-light { background: transparent; color: #cfd5dc; border: 1px solid rgba(255,255,255,0.2); padding: 4px 10px; font-size: 12px; border-radius: 4px; cursor: pointer; }
.link-light:hover { background: rgba(255,255,255,0.1); }
nav { display: flex; gap: 8px; }
.tab { background: transparent; color: #cfd5dc; border: 1px solid transparent; padding: 8px 14px; cursor: pointer; border-radius: 6px; font-size: 14px; }
.tab:hover { background: rgba(255,255,255,0.08); }
.tab.active { background: #fff; color: #2c3e50; }

main { max-width: 1100px; margin: 24px auto; padding: 0 24px; }
.panel { display: none; background: #fff; padding: 24px; border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.panel.active { display: block; }
h2 { margin-top: 0; }
h3 { margin-top: 28px; border-top: 1px solid #eee; padding-top: 16px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid label { display: flex; flex-direction: column; font-size: 13px; color: #555; }
.grid label.full, .grid fieldset.full, .grid .full { grid-column: 1 / -1; }
.grid input, .grid select, .grid textarea {
  margin-top: 4px; padding: 8px 10px; font-size: 14px; border: 1px solid #ccd; border-radius: 6px; background: #fff;
}
.grid input:focus, .grid select:focus, .grid textarea:focus { outline: none; border-color: #4a90e2; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
fieldset { border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; }
fieldset legend { padding: 0 6px; font-size: 13px; color: #555; }

button { background: #4a90e2; color: #fff; border: none; padding: 9px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; }
button:hover { background: #3b7bc8; }
button[type="button"].secondary, #dep-all, #dep-none { background: #6b7280; }
button.link { background: transparent; color: #4a90e2; padding: 0; font-size: 12px; }
button:disabled { opacity: 0.6; cursor: wait; }

/* MultiSelect ───────────────────────────────────────────── */
.ms { position: relative; }
.ms-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; min-height: 22px; align-items: center; }
.ms-pill { background: #e7f1fe; color: #1a5dc4; padding: 2px 4px 2px 10px; border-radius: 12px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.ms-pill-x { cursor: pointer; opacity: 0.6; padding: 0 6px; font-size: 14px; line-height: 1; }
.ms-pill-x:hover { opacity: 1; }
.ms-pill.all { background: #d4edda; color: #155724; padding-right: 10px; }
.ms-input-wrap { position: relative; }
.ms-search { width: 100%; padding: 8px 10px; border: 1px solid #ccd; border-radius: 6px; font-size: 14px; background: #fff; }
.ms-search:focus { outline: none; border-color: #4a90e2; }
.ms-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ccd; border-radius: 6px; max-height: 320px; overflow: hidden; z-index: 100; margin-top: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.ms-dropdown.open { display: flex; flex-direction: column; }
.ms-controls { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #eee; background: #f9f9f9; flex-shrink: 0; }
.ms-controls button { padding: 4px 10px; font-size: 12px; background: #6b7280; }
.ms-counter { font-size: 12px; color: #666; margin-left: auto; }
.ms-list { overflow-y: auto; flex: 1; }
.ms-item { padding: 6px 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 13px; user-select: none; }
.ms-item:hover { background: #f0f6ff; }
.ms-item.selected { background: #e7f1fe; }
.ms-check { display: inline-block; width: 16px; height: 16px; border: 1px solid #aaa; border-radius: 3px; flex-shrink: 0; text-align: center; line-height: 14px; font-weight: bold; color: #fff; background: #fff; font-size: 11px; }
.ms-item.selected .ms-check { background: #4a90e2; border-color: #4a90e2; }
.ms-item.selected .ms-check::before { content: '✓'; }
.ms-empty { padding: 12px; color: #999; text-align: center; font-size: 13px; }

.muted { color: #666; font-size: 12px; }
.hidden { display: none; }

.status-ok { color: #137333; }
.status-err { color: #c5221f; }

#sched-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sched-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 6px; align-items: center; }
.sched-item .meta { flex: 1; }
.sched-item .meta b { display: block; font-size: 14px; }
.sched-item .meta small { color: #666; font-size: 12px; }
.sched-item .actions { display: flex; gap: 6px; }
.sched-item .actions button { padding: 4px 10px; font-size: 12px; }
.sched-item button.danger { background: #c5221f; }
.sched-item.disabled { opacity: 0.55; }

code { background: #f0f0f0; padding: 1px 6px; border-radius: 3px; font-size: 12px; }

.note { margin-top: 24px; padding: 14px 18px; background: #fff8e6; border: 1px solid #f0d68b; border-radius: 8px; font-size: 13px; color: #523c00; }
.note-title { font-weight: 600; margin-bottom: 8px; color: #7a5a00; }
.note p { margin: 8px 0; }
.note ul { margin: 8px 0; padding-left: 22px; }
.note li { margin: 4px 0; }
.note b { color: #2c3e50; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: #fff; padding: 0 4px; border-radius: 3px; border: 1px solid #e5d9a8; }
.note .muted { color: #8c7a3a; }
