:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7f;
  --accent: #0d47a1;
  --accent-hover: #1565c0;
  --border: #d7e0ec;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(13, 71, 161, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(160deg, #e8eef8 0%, var(--bg) 45%, #f0f4fa 100%);
}

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

a:hover {
  color: var(--accent-hover);
}

.wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

@media (min-width: 768px) {
  .wrap {
    max-width: 720px;
    padding: 2rem 1.5rem 3rem;
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .card {
    padding: 2rem;
  }
}

.logo {
  display: block;
  max-width: 220px;
  height: auto;
  margin: 0 auto 1.25rem;
}

@media (min-width: 768px) {
  .logo {
    max-width: 280px;
    margin-bottom: 1.5rem;
  }
}

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  text-align: center;
  color: var(--accent);
}

.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfd;
  font-family: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(13, 71, 161, 0.35);
  outline-offset: 0;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: #e8eef5;
  color: var(--text);
  width: 100%;
  margin-top: 0.75rem;
}

.btn-secondary:hover {
  background: #dce4ef;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  width: auto;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ffcdd2;
}

.alert-success {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #c8e6c9;
}

.viewer-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 600px) {
  .viewer-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  width: 100%;
}

@media (min-width: 600px) {
  .btn-outline {
    width: auto;
  }
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.viewer-hint {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.pdf-frame {
  width: 100%;
  min-height: 70dvh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #525659;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list li {
  border-bottom: 1px solid var(--border);
}

.file-list li:last-child {
  border-bottom: none;
}

.file-list a {
  display: block;
  padding: 0.85rem 0;
  text-decoration: none;
  font-weight: 500;
}

.file-list a:hover {
  text-decoration: underline;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

footer.site-footer {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.admin-section h2 {
  font-size: 1rem;
  margin: 0 0 1rem;
  color: var(--accent);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
