:root {
    --bg: #f5f7f9;
    --card: #ffffff;
    --line: #e3e8ed;
    --text: #27313a;
    --muted: #6b7782;
    --available-bg: #edf8f1;
    --available: #238a4b;
    --request-bg: #fff7df;
    --request: #b47b00;
    --full-bg: #fbeeee;
    --full: #c74444;
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    padding: 24px;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  }

  .schedule {
    width: min(100%, 980px);
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(31, 45, 61, .08);
    overflow: hidden;
  }

  .schedule-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
  }

  .schedule-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .02em;
  }

  .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
    color: var(--muted);
    font-size: .85rem;
  }

  .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .legend-mark {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    font-weight: 700;
  }

  .legend-mark.available { background: var(--available-bg); color: var(--available); }
  .legend-mark.request { background: var(--request-bg); color: var(--request); }
  .legend-mark.full { background: var(--full-bg); color: var(--full); }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .availability-table {
    width: 100%;
    min-width: 620px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: .95rem;
  }

  .availability-table th,
  .availability-table td {
    height: 46px;
    padding: 7px 6px;
    text-align: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .availability-table tr:last-child td { border-bottom: 0; }

  .availability-table th:last-child,
  .availability-table td:last-child { border-right: 0; }

  .availability-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafb;
    color: #3b4650;
    font-weight: 700;
  }

  .availability-table .time-head,
  .availability-table .time-cell {
    width: 76px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
    font-variant-numeric: tabular-nums;
  }

  .availability-table .time-head {
    z-index: 4;
    background: #f8fafb;
  }

  .availability-table .date-head {
    min-width: 78px;
  }

  .availability-table tbody tr:nth-child(even) .time-cell {
    background: #fbfcfd;
  }

  .availability-table .status {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
  }

  .availability-table .available {
    color: var(--available);
    background: var(--available-bg);
  }

  .availability-table .request {
    color: var(--request);
    background: var(--request-bg);
  }

  .availability-table .full {
    color: var(--full);
    background: var(--full-bg);
  }

  @media (max-width: 640px) {
    body {
      padding: 10px;
    }

    .schedule {
      border-radius: 12px;
    }

    .schedule-header {
      padding: 14px;
    }

    .schedule-title {
      font-size: 1rem;
    }

    .availability-table {
      min-width: 600px;
      font-size: .88rem;
    }

    .availability-table th,
    .availability-table td {
      height: 42px;
      padding: 6px 5px;
    }

    .availability-table .time-head,
    .availability-table .time-cell {
      width: 68px;
    }

    .availability-table .status {
      font-size: 1.15rem;
    }
  }

  dialog {
    width: min(90%, 550px);
    padding: 24px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
  }

  dialog::backdrop {
    background: rgba(0, 0, 0, .4);
  }

  dialog h2 {
    margin-top: 0;
  }

  dialog button {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
  }


  .clickable {
    cursor: pointer;
  }
  .clickable:hover {
    filter: brightness(0.95);
  }
