:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #0f766e;
  --accent-soft: #99f6e4;
  --error: #b91c1c;
  --ok: #166534;
  --line: #d1d5db;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #eef2ff, #f8fafc);
  color: var(--text);
}

.mobile-wrap { max-width: 720px; margin: 0 auto; padding: 12px; }
.admin-wrap { max-width: 480px; margin: 48px auto; }
.topbar, .admin-topbar {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
}
.admin-topbar nav a { margin-right: 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 10px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 0 10px;
}

label { display: block; margin-bottom: 10px; font-size: 14px; }
input, select, textarea, button {
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
}
button.ghost, a.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
  width: auto;
}
.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.error { color: var(--error); }
.ok { color: var(--ok); }
.muted { color: var(--muted); font-size: 12px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}
.availability-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.availability-list li {
  padding: 8px 0;
  border-bottom: 1px solid #edf2f7;
  font-size: 14px;
  line-height: 1.5;
}
.availability-list li.day-sun {
  background: #fff1f1;
}
.availability-list li.day-sat {
  background: #eff6ff;
}
.availability-table tr.day-sun td {
  background: #fff1f1;
}
.availability-table tr.day-sat td {
  background: #eff6ff;
}
.utilization-table td {
  min-width: 120px;
}
.util-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-bottom: 4px;
}
.util-fill {
  height: 100%;
  background: #0f766e;
}
.util-fill.total {
  background: #0369a1;
}
.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5e7eb;
}
.badge.done { background: #d1fae5; color: #065f46; }

.progress-wrap { display: flex; gap: 12px; align-items: center; }
.pie { width: 120px; height: 120px; }
.pie .bg { fill: none; stroke: #e5e7eb; stroke-width: 2.5; }
.pie .meter {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.8;
  stroke-linecap: round;
}
.pie .percent { font-size: 0.45rem; text-anchor: middle; fill: #0f172a; }

.attach-image { width: 100%; border-radius: 8px; margin-top: 8px; }
.rte {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border: 1px solid var(--line);
  padding: 6px;
  text-align: left;
}

.code-sample {
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
}

@media (max-width: 640px) {
  table, thead, tbody, tr, td, th { display: block; }
  tr { margin-bottom: 8px; border: 1px solid var(--line); }
}

/* Cast-only theme */
.cast-theme {
  --tp-bg-top: #ffe7ef;
  --tp-bg-bottom: #fff8fb;
  --tp-card: #ffffff;
  --tp-line: #f4cad7;
  --tp-text: #553947;
  --tp-muted: #8a6474;
  --tp-accent: #e55287;
  --tp-accent-weak: #fff0f5;
  --tp-done-bg: #ffe2ec;
  --tp-done-text: #ad2f62;
  --tp-shadow: 0 8px 20px rgba(168, 74, 109, 0.12);
  font-family: "Hiragino Maru Gothic ProN", "YuGothic", "Yu Gothic", "Hiragino Sans", sans-serif;
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0) 26%),
    radial-gradient(circle at 90% 0%, rgba(255, 203, 220, 0.45) 0, rgba(255, 203, 220, 0) 30%),
    linear-gradient(180deg, var(--tp-bg-top), var(--tp-bg-bottom) 56%);
  color: var(--tp-text);
}

.cast-theme .topbar {
  margin: 10px;
  border: 1px solid var(--tp-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--tp-shadow);
}

.cast-theme .card {
  border: 1px solid var(--tp-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fff9fc);
  box-shadow: var(--tp-shadow);
  padding: 16px;
}

.cast-theme h1,
.cast-theme h2,
.cast-theme h3 {
  color: #7d3e58;
  letter-spacing: 0.02em;
}

.cast-theme input,
.cast-theme select,
.cast-theme textarea,
.cast-theme button {
  border-radius: 999px;
}

.cast-theme input,
.cast-theme select,
.cast-theme textarea {
  border: 1px solid #efbfd0;
  background: #fff;
}

.cast-theme button {
  background: linear-gradient(90deg, #ef5f94, #df4f85);
  box-shadow: 0 6px 14px rgba(223, 79, 133, 0.26);
}

.cast-theme button.ghost,
.cast-theme a.ghost {
  border: 1px solid #e883aa;
  color: #c03972;
  background: var(--tp-accent-weak);
}

.cast-theme .muted {
  color: var(--tp-muted);
}

.cast-theme .list li {
  border-bottom: 1px dashed #f2c5d6;
}

.cast-theme .list li a {
  color: #a32e61;
  text-decoration: none;
  font-weight: 700;
}

.cast-theme .badge {
  background: #fce8ef;
  color: #9e3d63;
}

.cast-theme .badge.done {
  background: var(--tp-done-bg);
  color: var(--tp-done-text);
}

.cast-theme .availability-list li {
  border-bottom: 1px dashed #f2c5d6;
  border-radius: 10px;
  padding: 9px 10px;
}

.cast-theme .availability-list li.day-sun {
  background: #fff2f7;
}

.cast-theme .availability-list li.day-sat {
  background: #f8f3ff;
}

.cast-theme .pie .bg {
  stroke: #f9ccdd;
}

.cast-theme .pie .meter {
  stroke: var(--tp-accent);
}

.cast-theme .pie .percent {
  fill: #95325b;
}

.cast-theme .content table {
  border-color: #efbfd0;
}

.cast-theme .content th,
.cast-theme .content td {
  border-color: #efbfd0;
}
