/* eepycat — pastel off-white minimal */
:root {
  --bg: #edf2f6;
  --surface: #ffffff;
  --ink: #3a3340;
  --ink-soft: #6c6376;
  --muted: #a39ba9;
  --line: #ece4d8;
  --line-strong: #ddd2c1;
  --accent: #c8b6e0;
  --shared: #cde3c5;
  --shadow: 0 1px 2px rgba(60, 50, 70, 0.04), 0 6px 16px rgba(60, 50, 70, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
/* Author rules with explicit `display` (e.g. `.modal { display: flex }`) win
   against the UA stylesheet's `[hidden] { display: none }`. Restore it. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select, button { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--ink-soft); }
.spacer { flex: 1; }

/* ---------------- Login ---------------- */
.login-card {
  max-width: 340px;
  margin: 12vh auto;
  background: var(--surface);
  padding: 32px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card .logo { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--accent); }
.login-card h1 { font-size: 26px; color: var(--ink); }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.login-card input {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  text-align: center;
  letter-spacing: 0.04em;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.login-card button {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  transition: filter 0.15s ease;
}
.login-card button:hover { filter: brightness(0.96); }
.error { color: #b35a6a; margin-top: 10px; }

/* ---------------- Topbar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.brand span { color: var(--ink); font-size: 17px; letter-spacing: 0.02em; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  font-weight: 600;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--accent); color: var(--ink); }
.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------------- View container ---------------- */
#view { padding: 22px; max-width: 1100px; margin: 0 auto; }

/* ---------------- Agenda day ---------------- */
.agenda-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.agenda-header .nav { display: flex; gap: 4px; }
.agenda-header h2 { font-size: 22px; font-weight: 700; flex: 1; }
.agenda-header .modes { display: flex; gap: 4px; }
.agenda-header .modes button {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
}
.agenda-header .modes button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.arrow-btn {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.arrow-btn:hover { background: var(--bg); color: var(--ink); }

.events-list { display: flex; flex-direction: column; gap: 10px; }
.event {
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  cursor: pointer;
}
.event:hover { transform: translateY(-1px); transition: transform 0.1s ease; }
.event .time { color: var(--ink-soft); font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.event .time .all-day-tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 6px; background: var(--bg); border-radius: 6px; display: inline-block; }
.event .title { font-weight: 700; font-size: 16px; }
.event .meta { color: var(--ink-soft); font-size: 13.5px; margin-top: 2px; }
.event .meta .dot { margin: 0 6px; opacity: 0.5; }
.event .desc { color: var(--ink-soft); font-size: 13.5px; margin-top: 6px; white-space: pre-wrap; }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  border: none;
  box-shadow: var(--shadow);
  font-size: 28px;
  line-height: 1;
  font-weight: 600;
  z-index: 5;
}
.fab:hover { filter: brightness(0.96); }

/* ---------------- Agenda week ---------------- */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.week-col {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 240px;
  box-shadow: var(--shadow);
}
.week-col h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.week-col h3.today { color: var(--ink); }
.week-col h3 .day-num { display: block; color: var(--ink); font-size: 18px; margin-top: 2px; }
.week-event {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.week-event .t { font-weight: 700; color: var(--ink-soft); margin-right: 4px; }

@media (max-width: 720px) {
  .week-grid { display: none; }
  .agenda-header .modes button[data-mode="week"] { display: none; }
}

/* ---------------- Calendar ---------------- */
.cal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.cal-header h2 { flex: 1; font-size: 22px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-dow {
  background: var(--bg);
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 8px 0;
}
.cal-cell {
  background: var(--surface);
  min-height: 100px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}
.cal-cell.dim { background: var(--bg); color: var(--muted); }
.cal-cell.today .day-num { background: var(--accent); color: var(--ink); border-radius: 999px; padding: 1px 7px; }
.cal-cell .day-num { font-weight: 700; display: inline-block; margin-bottom: 4px; }
.cal-cell .ev {
  background: var(--accent);
  color: var(--ink);
  border-radius: 4px;
  padding: 1px 5px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-cell .ev .t { font-weight: 700; margin-right: 2px; }

@media (max-width: 720px) {
  .cal-cell { min-height: 60px; }
  .cal-cell .ev { padding: 0 3px; font-size: 10.5px; }
}

/* ---------------- Pins ---------------- */
.pins-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.pins-header h2 { flex: 1; font-size: 22px; }
.pins-wall {
  column-count: 3;
  column-gap: 14px;
}
@media (max-width: 900px) { .pins-wall { column-count: 2; } }
@media (max-width: 540px) { .pins-wall { column-count: 1; } }

.pin {
  break-inside: avoid;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
  position: relative;
}
.pin .pin-title { font-weight: 700; margin-bottom: 4px; }
.pin .pin-note { white-space: pre-wrap; color: var(--ink); font-size: 14px; }
.pin .pin-link { display: block; color: var(--ink); font-size: 13px; word-break: break-all; margin-top: 8px; padding: 6px 8px; background: var(--bg); border-radius: 8px; text-decoration: none; }
.pin .pin-link:hover { background: var(--line); }
.pin .pin-file img { display: block; width: 100%; border-radius: 8px; margin-top: 8px; }
.pin .pin-file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
}
.pin .pin-file-card .ext {
  background: var(--surface);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.pin .pin-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.pin .pin-meta .by { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pin .pin-del {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  opacity: 0;
  font-size: 16px;
  padding: 4px;
  border-radius: 6px;
}
.pin:hover .pin-del { opacity: 1; }
.pin .pin-del:hover { background: var(--bg); color: #b35a6a; }

/* ---------------- Spreadsheets ---------------- */
.ss-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.ss-header h2 { flex: 1; font-size: 22px; }
.ss-header .file-name { font-weight: 700; }
.ss-header .save-status {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 4px 10px;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--line);
  min-width: 70px;
  text-align: center;
}
.ss-header .save-status.saving { color: var(--ink); }
.ss-header .save-status.saved { color: var(--ink-soft); }
.ss-header .save-status.error { color: #b35a6a; }
.ss-header .close-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
.ss-header .close-btn:hover { background: var(--bg); color: var(--ink); }

.ss-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ss-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  border-left: 4px solid var(--accent);
}
.ss-list-item:hover { background: var(--bg); }
.ss-list-item .ext {
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.ss-list-item .by {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ss-grid-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 180px);
}
.ss-grid {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  width: max-content;
  min-width: 100%;
}
.ss-grid th, .ss-grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  background: var(--surface);
}
.ss-grid th {
  background: var(--bg);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
  padding: 4px 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 32px;
}
.ss-grid th.row-h {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 38px;
}
.ss-grid td.row-h {
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 38px;
  padding: 4px 6px;
}
.ss-grid td input {
  width: 100%;
  min-width: 90px;
  border: none;
  background: transparent;
  padding: 5px 8px;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.ss-grid td:focus-within { background: var(--bg); box-shadow: inset 0 0 0 2px var(--accent); }

.ss-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ss-actions button {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 600;
}
.ss-actions button:hover { background: var(--bg); color: var(--ink); }

/* ---------------- Modals ---------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(60, 50, 70, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  width: min(520px, 100%);
  max-height: 92vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal-card header {
  display: flex;
  align-items: center;
  padding: 16px 18px 8px;
}
.modal-card header h2 { flex: 1; font-size: 18px; }
.modal-card .close {
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-soft);
  padding: 0 6px;
}
.modal-body { padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.modal-body input[type="text"],
.modal-body input[type="url"],
.modal-body input[type="time"],
.modal-body input[type="date"],
.modal-body textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg);
}
.modal-body input:focus,
.modal-body textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 4px; }
.time-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.time-row > div:first-child { grid-column: span 1; }
@media (max-width: 480px) { .time-row { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 8px; }
.row.toggle { gap: 10px; cursor: pointer; }
.row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.modal-actions button {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
}
.modal-actions .primary { background: var(--accent); color: var(--ink); }
.modal-actions .ghost { background: transparent; color: var(--ink-soft); }
.modal-actions .danger { background: transparent; color: #b35a6a; border: 1px solid #e6c4cb; }

/* people field */
.people-field { position: relative; }
.people-field .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.people-field .tag {
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.people-field .tag button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 16px;
  line-height: 1;
}
.people-field .suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  z-index: 5;
  max-height: 180px;
  overflow: auto;
}
.people-field .suggest button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 12px;
}
.people-field .suggest button:hover,
.people-field .suggest button.active { background: var(--bg); }

.file-drop {
  display: block;
  text-align: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
}
.file-drop:hover { background: var(--surface); }

/* color picker */
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.color-picker button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.color-picker button.active { border-color: var(--ink); }

/* toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 100;
  box-shadow: var(--shadow);
}
