:root {
  --bg: #fdf8f0;
  --card: #ffffff;
  --ink: #33291f;
  --muted: #8a7d6c;
  --accent: #e8603c;
  --accent-soft: #fbe4dc;
  --border: #ece2d3;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 40, 20, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea {
  font-family: inherit;
  font-size: 16px;
}

/* ---------- Login page ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.auth-card h1 {
  font-size: 22px;
  margin: 0 0 4px;
  text-align: center;
}

.auth-card p.sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 14px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdfa;
}

.btn {
  display: block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
}

.toggle-row {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}

.toggle-row a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.error-msg {
  background: #fdecea;
  color: #c0392b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 14px;
}

.hidden { display: none !important; }

/* ---------- Language switch ---------- */
.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-switch button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.lang-switch button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.auth-card .lang-switch {
  justify-content: center;
  margin-bottom: 12px;
}

/* ---------- App shell ---------- */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.app-header .row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-title {
  font-size: 19px;
  font-weight: 700;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.week-nav .nav-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  color: var(--accent);
}

.week-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.week-label .today-link {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--accent);
  margin-top: 2px;
}

main {
  padding: 12px 16px 80px;
  max-width: 640px;
  margin: 0 auto;
}

.day-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}

.day-card.today {
  outline: 2px solid var(--accent);
}

.day-heading {
  padding: 12px 16px 6px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-heading-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.day-heading .date-num {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.share-btn {
  background: none;
  border: none;
  font-size: 15px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
}

.slot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.slot-row:active { background: var(--accent-soft); }

.slot-row.readonly { cursor: default; }
.slot-row.readonly:active { background: none; }

.view-error {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 16px;
  color: var(--muted);
  text-align: center;
}

.slot-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  width: 68px;
  flex-shrink: 0;
}

.slot-content {
  flex: 1;
  min-width: 0;
}

.slot-title {
  font-size: 15px;
  font-weight: 600;
}

.slot-title.empty {
  color: var(--muted);
  font-weight: 400;
}

.slot-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 10, 0.4);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}

.modal-sheet {
  background: var(--card);
  width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 28px;
}

.modal-sheet h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdfa;
  min-height: 70px;
  resize: vertical;
}

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

.modal-actions .btn { margin-top: 0; }

.btn.danger {
  background: transparent;
  color: #c0392b;
  border: 1px solid #f0c4bd;
}

.share-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}

.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffdfa;
  font-size: 13px;
}

.share-link-row .btn {
  width: auto;
  margin-top: 0;
  padding: 10px 14px;
}

#shareBody .btn.danger {
  width: 100%;
}
