*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: sans-serif;
  background: #fdf6ee;
  color: #333;
  min-height: 100vh;
}

#page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  gap: 1rem;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

h1 { font-size: 1.4rem; }

#header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#export-btn {
  padding: 0.48rem 0.9rem;
  background: rgba(255,255,255,0.8);
  border: 1.5px solid #e8ddd0;
  border-radius: 10px;
  color: #666;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
#export-btn:hover { background: #fff; color: #444; }

.nav-btn {
  padding: 0.48rem 0.9rem;
  background: rgba(255,255,255,0.8);
  border: 1.5px solid #e8ddd0;
  border-radius: 10px;
  text-decoration: none;
  color: #666;
  font-size: 0.83rem;
  font-weight: 600;
  transition: background 0.15s;
}
.nav-btn:hover { background: #fff; color: #444; }

/* ── Filters ──────────────────────────────────────────────────────────────── */

#filters {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

#filter-text, #filter-cat {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.48rem 0.75rem;
  border: 1.5px solid #ddd;
  border-radius: 9px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
#filter-text { width: 220px; }
#filter-text:focus, #filter-cat:focus { border-color: #f4a5c0; }

#row-count {
  font-size: 0.8rem;
  color: #bbb;
  margin-left: 0.2rem;
}

/* ── Table wrapper ────────────────────────────────────────────────────────── */

#table-wrap {
  background: rgba(255,255,255,0.88);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
  overflow-x: auto;
}

#table-wrap.hidden { display: none; }

/* ── Table ────────────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

thead {
  background: #faf4ee;
  border-bottom: 2px solid #ede4d8;
}

th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #aaa;
  white-space: nowrap;
  user-select: none;
}
th:hover { color: #888; }

.sort-icon { color: #f4a5c0; }

td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f0e8df;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fdf6f0; }

/* ── Cell types ───────────────────────────────────────────────────────────── */

.name-cell {
  font-weight: 600;
  min-width: 160px;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  background: #f5ece2;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.notes-cell { max-width: 220px; }
.notes-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #666;
  font-style: italic;
}

.empty-cell { color: #ccc; }

.date-cell {
  color: #aaa;
  font-size: 0.8rem;
  white-space: nowrap;
}

.place-link {
  color: inherit;
  text-decoration: none;
}
.place-link:hover { text-decoration: underline; color: #d47fa6; }

.addr-col { width: 44px; text-align: center; }
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.15rem 0.3rem;
  border-radius: 5px;
  line-height: 1;
  transition: background 0.12s;
}
.copy-btn:hover { background: #f0e6da; }
.copy-btn.copied { color: #3aab5c; }

.priority-col { width: 36px; text-align: center; }
.priority-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 5px;
  opacity: 0.18;
  transition: opacity 0.15s, background 0.12s;
}
.priority-btn:hover { opacity: 0.55; background: #fff8e0; }
.priority-btn.is-priority { opacity: 1; }

tr.priority-row td { background: #fffbea; }
tr.priority-row:hover td { background: #fff6d6; }

#filter-priority-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  padding: 0.44rem 0.75rem;
  border: 1.5px solid #ddd;
  border-radius: 9px;
  background: #fff;
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
#filter-priority-wrap:hover { background: #fffbea; border-color: #e8d88a; }
#filter-priority-wrap:has(input:checked) { background: #fffbea; border-color: #e8d88a; color: #7a6000; font-weight: 600; }
#filter-priority-wrap input { accent-color: #e8b800; }

.action-col { width: 68px; text-align: center; white-space: nowrap; }

.edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 5px;
}
.edit-btn:hover { background: #e8f0fe; color: #4a7fc1; }

.del-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ddd;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 5px;
}
.del-btn:hover { background: #fde8e8; color: #c44; }

/* ── States ───────────────────────────────────────────────────────────────── */

#loading-row td,
.no-results,
.error-cell {
  text-align: center;
  padding: 2rem;
  color: #bbb;
  font-style: italic;
}
.error-cell { color: #c44; }

#empty-msg {
  text-align: center;
  padding: 3rem;
  color: #bbb;
  font-size: 0.95rem;
}
#empty-msg.hidden { display: none; }
#empty-msg a { color: #f4a5c0; text-decoration: none; font-weight: 600; }
#empty-msg a:hover { text-decoration: underline; }
