
:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --text: #253047;
  --muted: #718096;
  --primary: #728fc9;
  --primary-dark: #5575b5;
  --border: #e1e7f0;
  --danger: #d65f70;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    sans-serif;
  line-height: 1.6;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: background .15s, transform .15s;
}

button:hover {
  filter: brightness(.97);
}

button:active {
  transform: scale(.98);
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

input:focus, textarea:focus, select:focus,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

label {
  display: block;
  margin: 17px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 { font-size: 23px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }

.hidden {
  display: none !important;
}

.hint, .subtitle {
  color: var(--muted);
  font-size: 13px;
}

.primary, .secondary, .danger {
  border: none;
  border-radius: 10px;
  padding: 11px 17px;
  font-weight: 600;
}

.primary {
  background: var(--primary);
  color: white;
}

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

.secondary {
  background: #edf1f8;
  color: #52627e;
}

.danger {
  background: #fff0f2;
  color: var(--danger);
}

.full {
  width: 100%;
  margin-top: 24px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(100%, 420px);
  padding: 32px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 12px 45px #56688716;
}

.logo {
  font-size: 46px;
  color: var(--primary);
}

.auth-switch {
  display: flex;
  background: #edf1f8;
  padding: 4px;
  border-radius: 12px;
  margin: 25px 0;
}

.auth-switch button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.auth-switch button.active {
  background: white;
  color: var(--primary-dark);
  box-shadow: 0 2px 7px #0000000c;
}

.app {
  max-width: 1250px;
  margin: auto;
  padding: 24px;
}

.app-header, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header p {
  color: var(--muted);
  font-size: 13px;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin: 26px 0;
}

.tab {
  border: none;
  background: transparent;
  padding: 12px 18px;
  color: var(--muted);
  font-weight: 600;
}

.tab.active {
  color: var(--primary-dark);
  border-bottom: 3px solid var(--primary);
}

.date-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.date-bar h2 {
  margin: 0;
  min-width: 190px;
  text-align: center;
}

.arrow {
  border: none;
  background: white;
  color: var(--primary-dark);
  border-radius: 10px;
  width: 38px;
  height: 38px;
}

.daily-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr)
                         minmax(260px, 1fr);
  align-items: start;
  gap: 20px;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 3px 16px #23314f06;
}

.section-heading h3 {
  margin-bottom: 8px;
}

.schedule-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 45px repeat(6, minmax(43px, 1fr));
  grid-template-rows: 28px repeat(24, 33px);
  gap: 3px;
  min-width: 330px;
}

.grid-heading {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  align-self: center;
}

.hour-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
}

.slot {
  padding: 2px;
  min-width: 0;
  border: 1px solid #edf0f6;
  border-radius: 4px;
  background: #f4f6fb;
  color: #273244;
  position: relative;
  font-size: 9px;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  touch-action: manipulation;
}

.slot.occupied {
  border-color: #ffffff88;
  font-weight: 600;
}

.slot.drop-target {
  outline: 3px solid var(--primary);
  outline-offset: -2px;
}

.slot.current {
  box-shadow: inset 0 0 0 2px #e6a366;
}

.small-button {
  border: none;
  background: #eaf0fb;
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.task-card {
  background: #f0f2ff;
  border: 1px solid #e1e3ff;
  padding: 13px;
  border-radius: 12px;
  cursor: grab;
}

.task-card.selected {
  outline: 3px solid var(--primary);
}

.task-card h4 {
  margin: 0 0 5px;
  font-size: 14px;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.task-card button {
  margin-top: 9px;
}

.selected-message {
  color: var(--primary-dark);
  font-size: 12px;
}

.empty-state {
  padding: 28px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.form-panel {
  max-width: 650px;
  margin: 0 auto;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

#toast {
  position: fixed;
  z-index: 100;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 500px);
  padding: 12px 20px;
  background: #29344d;
  color: white;
  border-radius: 12px;
  box-shadow: 0 6px 25px #0002;
  display: none;
  text-align: center;
  font-size: 13px;
}

#toast.show {
  display: block;
}

@media (max-width: 760px) {
  .app {
    padding: 13px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header h1 {
    font-size: 20px;
  }

  .tabs {
    margin: 18px 0;
  }

  .tab {
    flex: 1;
    padding: 12px 5px;
    font-size: 13px;
  }

  .daily-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .schedule-grid {
    grid-template-rows: 27px repeat(24, 36px);
  }

  .date-bar {
    gap: 8px;
  }

  .date-bar h2 {
    min-width: 155px;
    font-size: 17px;
  }

  .account {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
