:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2f5d50;
  --primary-hover: #24473d;
  --danger: #b3261e;
  --danger-hover: #8f1e18;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); }

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; }
h3.year-heading { font-size: 1rem; margin: 1.25rem 0 0.5rem; color: var(--muted); }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: -0.5rem; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.brand { font-weight: 600; }
.topnav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topnav a { text-decoration: none; font-size: 0.95rem; }
.topnav-user { color: var(--muted); font-size: 0.9rem; }

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card.narrow { max-width: 480px; }
.login-card { width: 100%; max-width: 380px; }

form label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
}
form label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 1.25rem;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-block { display: block; width: 100%; text-align: center; }

.inline-form { display: inline; margin: 0; }
.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
}
.link-button.danger { color: var(--danger); }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}
.alert-success { background: #e6f4ea; color: #1e4620; border: 1px solid #b7dfc0; }
.alert-error { background: #fdecea; color: #611a15; border: 1px solid #f3c2bd; }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.doc-list li:last-child { border-bottom: none; }
.doc-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  flex: 1;
}
.doc-link:hover { color: var(--primary); }
.doc-icon { font-size: 1.1rem; }
.doc-tag {
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  color: var(--muted);
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; }
.table-actions { text-align: right; }
.table-actions a { text-decoration: none; font-weight: 600; }

.danger-zone { border-color: #f3c2bd; }
.danger-zone form { margin-right: 0.75rem; }

@media (max-width: 560px) {
  .page-header { flex-direction: column; }
  .doc-list li { flex-wrap: wrap; }
}
