* { box-sizing: border-box; }

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #22272e;
  --muted: #6b7480;
  --line: #d8dde4;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --error: #b3261e;
  --ok: #1a7f37;
  --warn: #8a6100;
  --warn-bg: #fff7e0;
  --warn-line: #ecd9a8;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.hidden { display: none !important; }

/* image requirement warnings (low resolution / aspect ratio off) */
.image-requirements {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}
.image-warnings {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}
.image-warnings li {
    color: var(--warn);
    background: var(--warn-bg);
    border: 1px solid var(--warn-line);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 14px;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.primary:hover { filter: brightness(1.08); }
button.danger {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 2px 6px;
}
button.danger:hover { color: var(--error); }

input, .note {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--panel);
  color: var(--ink);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.status { min-height: 1.2em; font-size: 0.9em; margin: 8px 0 0; }
.status.error { color: var(--error); }
.status.ok { color: var(--ok); }

/* --- full-screen "cards" (create / missing views) --- */

.screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px 40px;
  max-width: 420px;
  box-shadow: 0 2px 10px rgba(20, 30, 45, 0.06);
}
.card h1 { margin: 0 0 12px; font-size: 1.5em; }
.card p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.card.center button { width: 100%; }

/* --- app layout --- */

#app-view { flex-direction: row; align-items: stretch; height: 100vh; }

.sidebar {
  width: 280px;
  flex: 0 0 280px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  overflow-y: auto;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* --- month tree --- */

.tree-root { font-size: 0.95em; }
.tree-label {
  display: block;
  font-weight: 600;
  padding: 4px 8px;
  color: var(--ink);
}
.month-tree {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--line);
}
.month-tree li { position: relative; }
.month-tree li::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 14px;
  width: 12px;
  border-top: 2px solid var(--line);
}
.month-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 7px 10px;
  text-align: left;
  color: var(--ink);
}
.month-btn:hover { background: var(--bg); }
.month-btn[aria-current="true"] {
  background: #e8efff;
  color: var(--accent);
  font-weight: 600;
}
.month-btn .name { flex: 1; }
.month-btn .count {
  font-size: 0.8em;
  color: var(--muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 8px;
}
.month-btn .img-flag { font-size: 0.75em; color: var(--muted); }
.month-btn[aria-current="true"] .img-flag { color: var(--accent); }

/* --- month editor --- */

.editor h2 {
  margin: 0 0 4px;
  font-size: 1.4em;
}
.editor .sub { color: var(--muted); margin: 0 0 20px; font-size: 0.9em; }

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.section h3 {
  margin: 0 0 12px;
  font-size: 1.05em;
}

/* image */

.image-preview {
  max-width: 520px;
  max-height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
  margin-bottom: 10px;
  background: var(--bg);
}
.image-meta { font-size: 0.85em; color: var(--muted); margin: 0 0 12px; }
.image-placeholder {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 12px;
}
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-row input[type="file"] { font-size: 0.85em; }

/* dates */

.date-form { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.date-form input[type="number"] { width: 90px; }
.date-form input[type="text"] { flex: 1; min-width: 180px; }

.date-list { list-style: none; margin: 0; padding: 0; }
.date-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--bg);
}
.date-list li:last-child { border-bottom: none; }
.date-day {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 2.2em;
}
.date-note { flex: 1; }
.empty { color: var(--muted); font-size: 0.9em; margin: 0; }
