:root {
  --app-bg: #f9f5eb;
  --header-bg: #e0d6c4;
  --card-bg: #ffffff;
  --line: #dbcbb3;
  --text-main: #2d2a1f;
  --text-soft: #7a6e5a;
  --accent-h: #c0622f;
  --accent-s: #7a9e7e;
  --accent-f: #d4a843;
  --btn-primary: #c0622f;
  --btn-secondary: #dbcbb3;
  --success: #7a9e7e;
  --warning: #d4a843;
  --danger: #b54c4c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--app-bg);
  color: var(--text-main);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  padding: 10px 12px 86px;
}

.screen { width: 100%; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(90, 75, 52, 0.08);
}

.login-card {
  margin-top: 20px;
  padding: 18px;
}

h1, h2, h3 { margin: 0 0 10px; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.2rem; }

.subtle,
.message,
.field label,
.label,
.detail-line {
  color: var(--text-soft);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.avatar-btn {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.avatar-btn.active {
  border-color: var(--accent-h);
  box-shadow: 0 0 0 2px rgba(192, 98, 47, 0.15);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar-h { background: var(--accent-h); }
.avatar-s { background: var(--accent-s); }
.avatar-f { background: var(--accent-f); }

input, select, textarea, button {
  width: 100%;
  font: inherit;
  color: var(--text-main);
}

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

textarea {
  min-height: 76px;
  resize: vertical;
}

button {
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
}

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

.btn-secondary {
  background: var(--btn-secondary);
}

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

.top-header {
  background: var(--header-bg);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.greeting {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.3;
}

.header-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: #f6efe2;
  border: 1px solid var(--line);
  position: relative;
}

.badge {
  position: absolute;
  right: -2px;
  top: -4px;
  background: var(--accent-h);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-hint {
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text-soft);
  background: #fffaf2;
  border-radius: 10px;
  border: 1px dashed var(--line);
}

.segmented-wrap {
  padding: 10px;
  margin-bottom: 10px;
}

.segmented, .tabs {
  display: grid;
  gap: 8px;
}

.segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 8px;
}

.tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented button,
.tabs button {
  background: #f4ede2;
  border: 1px solid var(--line);
}

.segmented button.active,
.tabs button.active {
  background: #fff;
  border-color: var(--accent-h);
  box-shadow: inset 0 0 0 1px rgba(192, 98, 47, 0.25);
}

.calendar-card {
  padding: 10px;
}

#calendar {
  min-height: 68vh;
}

.fc .fc-toolbar { display: none; }
.fc .fc-scrollgrid,
.fc-theme-standard td,
.fc-theme-standard th {
  border-color: var(--line);
}
.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion,
.fc .fc-timegrid-axis-cushion {
  color: var(--text-main);
}
.fc .fc-timegrid-slot-label-cushion,
.fc .fc-daygrid-more-link {
  color: var(--text-soft);
}
.fc-event {
  border-radius: 8px;
  border-width: 0 !important;
  padding: 1px 3px;
}

.fab {
  position: fixed;
  right: 16px;
  bottom: 88px;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: var(--accent-h);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(192, 98, 47, 0.35);
  z-index: 80;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f7f0e3;
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  z-index: 70;
}

.bottom-nav button {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 6px;
}

.bottom-nav button.active {
  border-color: var(--line);
  border-radius: 9px;
  background: #fff;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(45, 42, 31, 0.35);
  display: flex;
  align-items: flex-end;
}

.sheet-panel {
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  background: var(--card-bg);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  padding: 12px 14px 18px;
  animation: sheetUp 180ms ease-out;
}

@keyframes sheetUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 46px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 10px;
}

.field {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.check-row input { width: auto; }

.participant-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.participant-switches input { width: auto; }

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 10px;
}

.detail-summary {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  padding: 10px;
  margin-bottom: 10px;
}

.chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 4px 9px;
  font-size: 0.86rem;
}

.chip-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.notification-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.notification-list li.unread {
  border-left: 4px solid var(--accent-h);
  background: #fff8ee;
}

.notification-event-when {
  color: var(--text-main);
  font-weight: 600;
}

.notification-received {
  font-size: 0.82rem;
}

.detail-sharing {
  color: var(--accent-s);
}

.detail-sharing-offer {
  color: var(--text-soft);
}

.detail-proposal {
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}

.btn-inline-apply {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 8px;
  border: 1px solid var(--accent-h);
  background: var(--btn-primary);
  color: #fff;
  cursor: pointer;
}

.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn-notification {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  background: var(--btn-primary);
  color: #fff;
}

.btn-notification-secondary {
  background: var(--btn-secondary);
  color: var(--text-main);
}

.btn-notification-send {
  margin-top: 8px;
  width: 100%;
}

.btn-notification-decline {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
}

.fc .fc-event.fc-event-shared-context {
  box-shadow: inset 4px 0 0 var(--accent-s);
}

.join-propose-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.join-propose-fields {
  display: grid;
  gap: 8px;
}

.np-field {
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.np-field input {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.menu-actions {
  display: grid;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 94px;
  background: #2d2a1f;
  color: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  z-index: 150;
  font-size: 0.9rem;
}

@media (min-width: 860px) {
  .app-shell {
    max-width: 980px;
    margin: 0 auto;
  }
}
