:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --danger: #dc2626;
  --ok: #047857;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.container { max-width: 640px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin: 16px 0;
}
label { display: block; margin: 10px 0; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink);
  background: #fff;
}
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row label { flex: 1 1 120px; margin: 0; }
button, .button {
  display: inline-block; cursor: pointer; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; padding: 10px 16px; font: inherit;
  text-decoration: none;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.danger { background: var(--danger); }
button.small { padding: 5px 10px; font-size: .8rem; }
ul.list { list-style: none; padding: 0; margin: 12px 0 0; }
ul.list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--line);
}
ul.list li form { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ok { color: var(--ok); }
.err { color: var(--danger); }
.flash { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.flash.ok { background: #ecfdf5; color: var(--ok); }
.flash.err { background: #fef2f2; color: var(--danger); }
.tz-note { color: var(--muted); font-size: .8rem; margin-top: 28px; text-align: center; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: monospace; font-size: .85rem; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: .85em; }

/* ---- calendar grid ---- */
.container.cal-page { max-width: 1080px; }
.cal-scroll {
  display: flex; align-items: flex-start;
  max-height: 68vh; overflow: auto; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
.cal-axis {
  position: sticky; left: 0; z-index: 7; flex: 0 0 56px;
  background: #fff; border-right: 1px solid var(--line);
}
.cal-corner {
  position: sticky; top: 0; z-index: 9; background: #fff;
  border-bottom: 1px solid var(--line);
}
.cal-axis-body { position: relative; }
.cal-grid { display: grid; flex: 1 0 auto; position: relative; }
.cal-dayhead {
  position: sticky; top: 0; z-index: 6; background: #fff; box-sizing: border-box;
  border-bottom: 1px solid var(--line); border-left: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.cal-hour {
  position: absolute; right: 4px; transform: translateY(-50%);
  font-size: .68rem; color: var(--muted);
}
.cal-col {
  position: relative; border-left: 1px solid var(--line);
  cursor: crosshair; overflow: hidden;
}
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid #f0f1f3; }

.blk {
  position: absolute; left: 2px; right: 2px; border-radius: 5px;
  font-size: .68rem; overflow: hidden; box-sizing: border-box;
}
.blk-busy {
  background: repeating-linear-gradient(45deg, #cbd0d6, #cbd0d6 5px, #e3e6ea 5px, #e3e6ea 10px);
  color: var(--muted); z-index: 4; pointer-events: none;
}
.blk-window {
  background: #dbeafe; border: 1px solid var(--accent); color: #1e3a8a;
  z-index: 2; cursor: move; padding: 2px 4px;
}
.blk-avail {
  background: #dcfce7; border: 1px solid #16a34a; color: #14532d;
  z-index: 2; cursor: cell;
}
.blk-avail::after {
  content: "tap to request"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .66rem; color: #15803d; opacity: .7; pointer-events: none;
}
.blk-label { pointer-events: none; }
.blk-handle { position: absolute; left: 0; right: 0; height: 6px; cursor: ns-resize; }
.blk-top { top: 0; } .blk-bottom { bottom: 0; }
.blk-del {
  position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; padding: 0;
  line-height: 14px; font-size: 13px; border-radius: 4px; background: rgba(255,255,255,.7);
  color: var(--danger); cursor: pointer;
}
.blk-ghost {
  background: rgba(37,99,235,.25); border: 1px dashed var(--accent);
  z-index: 5; pointer-events: none; display: flex; align-items: center;
  justify-content: center; color: #1e3a8a; font-weight: 600;
}

/* ---- popup ---- */
.popup-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.popup {
  background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 360px;
  max-height: 90vh; overflow-y: auto;
}
.popup h3 { margin: 0 0 4px; }
.popup-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.muted-btn { background: #eef0f2; color: var(--ink); }
.cal-help { color: var(--muted); font-size: .82rem; margin: 4px 0 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.sw-avail { background: #dcfce7; border: 1px solid #16a34a; }
.sw-window { background: #dbeafe; border: 1px solid var(--accent); }
.sw-busy { background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 4px, #eef0f2 4px, #eef0f2 8px); }
