:root {
  --background: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #1e293b;
  --sub-text: #64748b;
  --border: #dbe3ef;
  --primary: #5b7cfa;
  --primary-hover: #4768ed;
  --danger: #e5484d;
  --shadow: 0 10px 30px rgba(30, 41, 59, 0.1);

  --part-time: #f59e0b;
  --work: #3b82f6;
  --school: #8b5cf6;
  --task: #ef476f;
  --play: #22c55e;
  --club: #ec4899;
  --volunteer: #14b8a6;
  --other: #64748b;
}

body.dark-mode {
  --background: #111827;
  --surface: #1f2937;
  --surface-soft: #293548;
  --text: #f8fafc;
  --sub-text: #bac6d6;
  --border: #3d4d63;
  --primary: #8ba1ff;
  --primary-hover: #a5b4fc;
  --danger: #fb7185;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN",
    "Hiragino Sans",
    "Yu Gothic",
    "Meiryo",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.header {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon,
.big-icon {
  display: grid;
  place-items: center;
 width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #5b7cfa, #a855f7);
  box-shadow: 0 8px 18px rgba(91, 124, 250, 0.3);
  font-size: 24px;
}

.logo-area h1 {
  margin: 0;
  font-size: 1.25rem;
}

.logo-area p {
  margin: 4px 0 0;
  color: var(--sub-text);
  font-size: 0.8rem;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.logout-button,
.primary-button,
.secondary-button,
.quick-button,
.nav-button,
.auth-tab {
  border: 0;
  transition: 0.2s;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  font-size: 1.1rem;
}

.icon-button:hover {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.logout-button,
.primary-button,
.secondary-button {
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
}

.logout-button,
.secondary-button {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

.logout-button:hover,
.secondary-button:hover {
  background: var(--surface-soft);
}

.primary-button {
  width: 100%;
  color: white;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-hover);
}

.full-button {
  width: 100%;
}

.auth-screen {
  width: min(480px, calc(100% - 32px));
  margin: 10px auto 50px;
}

.auth-card,
.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-title {
  margin-bottom: 22px;
  text-align: center;
}

.big-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  font-size: 27px;
}

.auth-title h2 {
  margin: 0;
  font-size: 1.3rem;
}

.auth-title p {
  margin: 9px 0 0;
  color: var(--sub-text);
  font-size: 0.9rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.auth-tab {
  padding: 10px;
  border-radius: 9px;
  color: var(--sub-text);
  background: transparent;
  font-weight: 700;
}

.auth-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: var(--surface);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 124, 250, 0.16);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--sub-text);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.app-screen {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 50px;
}

.nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.nav-button {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  color: var(--sub-text);
  background: transparent;
  font-weight: 700;
}

.nav-button.active {
  color: white;
  background: var(--primary);
}

.page-title-row,
.calendar-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.page-title-row h2,
.calendar-title h2 {
  margin: 4px 0;
  font-size: 1.45rem;
}

.sub-text {
  margin: 0;
  color: var(--sub-text);
  font-size: 0.85rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.quick-button {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 0.8rem;
}

.quick-button:hover {
  border-color: var(--primary);
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.end-time-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  color: var(--sub-text);
  background: var(--surface-soft);
  font-size: 0.88rem;
}

.end-time-box strong {
  color: var(--primary);
  font-size: 1.1rem;
}

.schedule-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.empty-text {
  margin: 0;
  padding: 30px 10px;
  color: var(--sub-text);
  text-align: center;
}

.schedule-item {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--other);
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  background: var(--surface-soft);
}

.schedule-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
}

.schedule-item-top,
.schedule-item-bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.schedule-item-top {
  font-size: 0.92rem;
}

.schedule-item-top span,
.schedule-item-bottom {
  color: var(--sub-text);
  font-size: 0.78rem;
}

.schedule-item-bottom {
  margin-top: 8px;
}

.category-part_time {
  border-left-color: var(--part-time);
}

.category-work {
  border-left-color: var(--work);
}

.category-school {
  border-left-color: var(--school);
}

.category-task {
  border-left-color: var(--task);
}

.category-play {
  border-left-color: var(--play);
}

.category-club {
  border-left-color: var(--club);
}

.category-volunteer {
  border-left-color: var(--volunteer);
}

.category-other {
  border-left-color: var(--other);
}

.calendar-title-row {
  justify-content: center;
  text-align: center;
}

.calendar-title {
  min-width: 210px;
}

.calendar-card {
  overflow-x: auto;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
}

.weekdays div {
  padding: 10px 4px;
  color: var(--sub-text);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.sunday {
  color: #ef476f !important;
}

.saturday {
  color: #3b82f6 !important;
}

.calendar-day {
  min-height: 120px;
  padding: 8px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.calendar-day:nth-child(7n) {
  border-right: 1px solid var(--border);
}

.empty-day {
  background: var(--surface-soft);
}

.calendar-day.today {
  background: rgba(91, 124, 250, 0.08);
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 5px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 800;
}

.today .day-number {
  color: white;
  background: var(--primary);
}

.calendar-event,
.more-event {
  display: block;
  width: 100%;
  margin: 3px 0;
  padding: 4px 5px;
  overflow: hidden;
  border: 0;
  border-left: 4px solid var(--other);
  border-radius: 5px;
  color: var(--text);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface-soft);
  font-size: 0.7rem;
}

.more-event {
  border-left: 0;
  color: var(--primary);
  background: transparent;
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 105px;
  }
}

@media (max-width: 500px) {
  .header,
  .app-screen {
    width: min(100% - 20px, 1200px);
  }

  .header {
    padding-top: 12px;
  }

  .logo-area h1 {
    font-size: 1rem;
  }

  .logo-area p {
    display: none;
  }

  .logout-button {
    padding: 10px;
    font-size: 0.78rem;
  }

  .auth-card,
  .card {
    padding: 18px;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }

  .page-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}