:root {
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --ink: #1f2430;
  --muted: #5d6472;
  --line: #ddd6c8;
  --accent: #1f6f8b;
  --accent-soft: #d7eef4;
  --mark: #c45c26;
  --mark-soft: #f7e2d4;
  --today: #1f6f8b;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Liberation Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #efe7d6 0, transparent 28%),
    var(--bg);
  min-height: 100vh;
}

.topbar,
.calendar-panel,
.table-panel {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

h1,
h2 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.subtitle,
.stats,
#table-hint {
  color: var(--muted);
  margin: 8px 0 0;
}

.stats {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.calendar-panel,
.table-panel {
  padding-bottom: 24px;
}

.year-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.year-nav button,
.year-select select {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
}

.year-nav button:hover,
.year-select select:hover {
  border-color: var(--accent);
}

.year-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.ghost {
  margin-left: auto;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.month {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.month h3 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.dow,
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.dow span,
.day {
  display: grid;
  place-items: center;
  height: 28px;
  font-size: 12px;
}

.dow span {
  color: var(--muted);
  font-weight: 600;
}

.day {
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--ink);
  cursor: default;
}

.day.has-data {
  background: var(--mark-soft);
  color: var(--mark);
  font-weight: 700;
  cursor: pointer;
}

.day.has-data:hover,
.day.selected {
  background: var(--mark);
  color: white;
}

.day.today:not(.has-data):not(.selected) {
  box-shadow: inset 0 0 0 1px var(--today);
}

.day.empty {
  visibility: hidden;
}

.table-panel {
  padding-bottom: 40px;
}

.table-head {
  margin-bottom: 12px;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: #faf6ee;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

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

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-bar form {
  margin: 0;
}

.ghost-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.ghost-link:hover {
  text-decoration: underline;
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card {
  width: min(420px, 100%);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 42px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
}

.auth-form button,
.danger {
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 16px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.auth-form button {
  background: var(--accent);
  color: #fff;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

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

.flash {
  border-radius: 10px;
  padding: 10px 12px;
}

.flash-error {
  background: #f8e4e0;
  color: #8a2f1d;
}

.flash-ok {
  background: #e4f3ea;
  color: #1f6b3a;
}

.admin-panel {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  margin-top: 18px;
}

.admin-card h2 {
  margin-bottom: 8px;
}

.danger {
  background: #f3d8d0;
  color: #8a2f1d;
}

.muted {
  color: var(--muted);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
}

.inline-form input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 34px;
  width: 130px;
  padding: 0 8px;
  font: inherit;
  background: #fff;
}

.inline-form button {
  border: 0;
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  font: inherit;
  font-weight: 650;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.auth-back {
  margin: 16px 0 0;
}

.password-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.checkbox-row.compact {
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .topbar-right {
    align-items: stretch;
  }
}
