:root {
  --bg: #f6f5f9; --panel: #ffffff; --ink: #1c1a24; --muted: #6b6878; --line: #e3e0ea;
  --accent: #6b3fd4; --accent-ink: #ffffff;
  --ent: #c2338a; --ent-bg: #fbe6f2; --emp: #1f6fd1; --emp-bg: #e3eefc;
  --ok: #1f8a4c; --warn: #b26a00; --bad: #c0392b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14121a; --panel: #1e1b26; --ink: #eeeaf6; --muted: #a29db2; --line: #332e40;
    --accent: #9b7bff; --accent-ink: #14121a; --ent: #ff6fbf; --ent-bg: #3a1a2e; --emp: #6aa8ff; --emp-bg: #182a44; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger, .link.danger { color: var(--bad); }
button.link { background: none; border: none; padding: 0 4px; color: var(--accent); }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
label { display: block; font-size: 13px; color: var(--muted); margin: 6px 0; }
label > input, label > select, label > textarea { margin-top: 3px; color: var(--ink); }
label.check { display: inline-flex; gap: 6px; align-items: center; }
label.check input { width: auto; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--bad); min-height: 1em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.brand { font-weight: 700; letter-spacing: .3px; } .gem { color: var(--accent); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 6px; } .login-card .brand { font-size: 20px; margin-bottom: 8px; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; } .tab { border: none; background: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); }
.tab.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.who { margin-left: auto; font-size: 13px; color: var(--muted); }
.panel { padding: 12px 16px 40px; max-width: 1300px; margin: 0 auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.toolbar .group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.toolbar h2 { font-size: 18px; margin: 0 8px; }
.toolbar input[type=search] { max-width: 320px; } .toolbar select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; } .seg button.active { background: var(--accent); color: var(--accent-ink); }
.legend { font-size: 13px; color: var(--muted); margin: 4px 0 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.dot.entertainer { background: var(--ent); } .dot.employee { background: var(--emp); }

.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); gap: 1px; }
.dow { background: var(--panel); text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; font-weight: 600; }
.cell { background: var(--panel); min-height: 110px; padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.grid.week .cell { min-height: 340px; }
.cell.out { background: var(--bg); } .cell.out .daynum { opacity: .45; }
.cell.today .daynum { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.daynum { font-size: 12px; font-weight: 600; }
.chip { display: block; width: 100%; text-align: left; border: none; border-left: 3px solid; border-radius: 6px; padding: 3px 6px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.entertainer { background: var(--ent-bg); border-color: var(--ent); } .chip.employee { background: var(--emp-bg); border-color: var(--emp); }
.chip-time { font-weight: 700; }
.st-cancelled { opacity: .5; text-decoration: line-through; } .st-no_show { opacity: .7; } .st-completed { opacity: .8; }

.list { display: grid; gap: 14px; } .list-day h4 { margin: 0 0 6px; }
.list-item { display: grid; grid-template-columns: 110px 1fr 100px 130px 100px; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid; border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; }
.list-item.entertainer { border-left-color: var(--ent); } .list-item.employee { border-left-color: var(--emp); }
.li-time { font-weight: 700; } .li-role, .li-phone { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); margin-right: 4px; text-decoration: none; }
.badge.st-scheduled, .badge.as-scheduled { color: var(--accent); } .badge.as-hired, .badge.st-completed { color: var(--ok); }
.badge.as-rejected, .badge.st-no_show, .badge.as-no_show { color: var(--bad); }
.empty { padding: 30px; text-align: center; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
table.apps { width: 100%; border-collapse: collapse; } .apps th, .apps td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.apps th { font-size: 12px; color: var(--muted); } .apps tbody tr { cursor: pointer; } .apps tbody tr:hover { background: var(--bg); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.settings-grid h3 { margin: 0 0 6px; }
.admin-only { display: none; } body.is-admin .admin-only { display: block; }
.copyrow { display: flex; gap: 6px; } .copyrow input { font-size: 12px; }
.hours-row { display: grid; grid-template-columns: 80px 1fr auto 1fr; gap: 8px; align-items: center; margin: 4px 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; }
.userlist { list-style: none; padding: 0; margin: 0 0 10px; } .userlist li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--ink); width: min(640px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 8, 16, .55); }
.dlg { padding: 18px; } .dlg h3 { margin: 0 0 8px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; padding: 4px 10px 8px; } legend { font-size: 13px; color: var(--muted); }
.dlg-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; } .spacer { flex: 1; }
.notes { background: var(--bg); border-radius: 8px; padding: 8px; max-height: 180px; overflow: auto; white-space: pre-wrap; font: 12px/1.4 ui-monospace, Consolas, monospace; margin: 0 0 6px; }

@media (max-width: 720px) {
  .topbar { gap: 8px; } .who { width: 100%; margin-left: 0; order: 3; }
  .panel { padding: 10px 16px 40px; }
  .grid.month .cell { min-height: 64px; } .grid.month .chip-name { display: none; }
  .grid.week { grid-template-columns: 1fr; } .grid.week .dow { display: none; } .grid.week .cell { min-height: 60px; }
  .list-item { grid-template-columns: 90px 1fr; } .li-role, .li-phone { display: none; }
  .hours-row { grid-template-columns: 70px 1fr auto 1fr; }
}
