:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #1f2430;
  --text-muted: #6b7280;
  --primary: #2f6fed;
  --primary-dark: #244fb0;
  --available: #e8f5e9;
  --available-border: #66bb6a;
  --reserved: #eceff1;
  --reserved-border: #90a4ae;
  --blocked: #fff3e0;
  --blocked-border: #ffb74d;
  --own: #e3f2fd;
  --own-border: #2f6fed;
  --danger: #d64545;
  --danger-dark: #b23434;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

header.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

header.app-header h1 {
  font-size: 17px;
  margin: 0;
}

header.app-header .sub {
  font-size: 12px;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.info-box {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.75;
}

.info-box p {
  margin: 6px 0;
}

.info-box p:first-of-type {
  margin-top: 0;
}

.info-box p:last-of-type {
  margin-bottom: 0;
}

.info-box-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.info-box-primary {
  background: #eef4ff;
  border: 1px solid #c7d9f7;
  color: #1f3a66;
}

.info-box-primary .info-box-title {
  color: #1a4fb0;
}

.info-box-notice {
  background: #fff8e6;
  border: 1px solid #f0dfa8;
  color: #6b5417;
}

.info-box-notice .info-box-title {
  color: #96730c;
}

@media (max-width: 600px) {
  .info-box {
    font-size: 12.5px;
    padding: 12px 14px;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea,
select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  background: #fff;
  color: var(--text);
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 10px;
}

.field {
  margin-bottom: 4px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.day-nav .date-label {
  font-weight: 600;
  font-size: 15px;
}

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fafafa;
}

.slot-row .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  width: 96px;
  flex-shrink: 0;
  font-size: 13px;
}

.slot-row .info {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.slot-row .info .primary {
  font-weight: 600;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.month-weekday {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0 6px;
}

.month-cell {
  min-height: 84px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.month-cell:hover {
  border-color: var(--primary);
}

.month-cell.other-month {
  background: transparent;
  border-color: transparent;
  cursor: default;
  opacity: 0.4;
}

.month-cell.other-month:hover {
  border-color: transparent;
}

.month-cell .daynum {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.month-cell.today {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.month-cell.today .daynum {
  color: var(--primary);
}

.month-cell.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.month-cell.own-day {
  border-color: var(--own-border);
  background: var(--own);
}

.month-cell.available-day {
  border-color: var(--available-border);
}

.month-cell.full-day {
  opacity: 0.7;
}

.month-chip {
  font-size: 10.5px;
  line-height: 1.4;
  background: var(--reserved);
  border: 1px solid var(--reserved-border);
  border-radius: 4px;
  padding: 1px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-chip.own {
  background: var(--own);
  border-color: var(--own-border);
}

.month-more {
  font-size: 10px;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .month-cell {
    min-height: 64px;
    padding: 2px;
  }
  .month-chip {
    font-size: 9px;
    padding: 0 2px;
  }
  .month-weekday {
    font-size: 10px;
  }
}

.slot-row.status-available {
  background: var(--available);
  border-color: var(--available-border);
}

.slot-row.status-reserved,
.slot-row.status-meeting {
  background: var(--reserved);
  border-color: var(--reserved-border);
}

.slot-row.status-blocked,
.slot-row.status-buffer {
  background: var(--blocked);
  border-color: var(--blocked-border);
}

.slot-row.status-own {
  background: var(--own);
  border-color: var(--own-border);
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  flex-shrink: 0;
}

.badge-buffer-before,
.badge-buffer-after {
  background: rgba(255, 152, 0, 0.18);
  color: #a15c00;
}

.badge-meeting {
  background: rgba(47, 111, 237, 0.15);
  color: var(--primary-dark);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.pill-active {
  background: #e8f5e9;
  color: #2e7d32;
}

.pill-inactive {
  background: #eceff1;
  color: #607d8b;
}

.pill-cancelled {
  background: #ffebee;
  color: #c62828;
}

.token-url {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text-muted);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tabs .btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

.badge-testing {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: #fff3e0;
  color: #a15c00;
  border: 1px solid #ffd699;
  vertical-align: middle;
  margin-left: 8px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.menu-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(47, 111, 237, 0.12);
}

.menu-card .ic {
  font-size: 20px;
}

.menu-card .nm {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.menu-card .ds {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.step-body {
  padding-top: 3px;
  font-size: 13.5px;
}

.home-section h2 {
  font-size: 14.5px;
  margin: 0 0 8px;
}

.home-section p {
  font-size: 13.5px;
  line-height: 1.8;
  margin: 6px 0;
}

.home-section ul {
  margin: 6px 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.9;
}

.copy-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  resize: vertical;
  line-height: 1.7;
}

@media (max-width: 600px) {
  .slot-row .time {
    width: 80px;
  }
  header.app-header h1 {
    font-size: 15px;
  }
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
