body {
  font-family: Arial, sans-serif;
  margin: 0;
  color: #22313f;
  background: #f3f6f9;
  line-height: 1.45;
}

a {
  color: #245fae;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #1a4d91;
  text-decoration: underline;
}

.container {
  width: 94%;
  max-width: 1200px;
  margin: 0 auto;
}

.topbar {
  background: linear-gradient(180deg, #223244 0%, #1f2d3d 100%);
  color: #fff;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px rgba(20, 35, 52, 0.12);
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.brand:hover {
  color: #fff;
  text-decoration: none;
}

.brand-subtitle {
  color: #aebed0;
  font-size: 12px;
}

.nav {
  display: contents;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.nav a,
.nav-action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d8e3ef;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav a i,
.nav-action-button i {
  font-size: 14px;
}

.nav a.active,
.nav a:hover,
.nav-action-button:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
}

.nav a.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-action-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.page-header {
  margin: 10px 0 20px;
}

.page-header h1 {
  margin-bottom: 4px;
}

.muted {
  color: #66788a;
}

.grid {
  display: grid;
  gap: 16px;
}

.cards-3 {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 16px;
}

.two-columns {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 16px;
}

.card {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(31, 45, 61, 0.04);
  margin-bottom: 16px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 18px;
}

.card.narrow {
  max-width: 420px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding-top: 20px;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #2d7ff9;
}

.stat-card-accent-2::before {
  background: #2f855a;
}

.stat-card-accent-3::before {
  background: #6b7280;
}

.stat-label {
  margin: 0 0 8px;
  color: #66788a;
  font-size: 14px;
}

.stat-value {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  color: #1f2d3d;
}

.searchbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  color: #31475b;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c7d3df;
  border-radius: 6px;
  box-sizing: border-box;
  background: #fff;
  color: #22313f;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #2d7ff9;
  box-shadow: 0 0 0 3px rgba(45, 127, 249, 0.12);
}

.form-group {
  margin-bottom: 14px;
}

button,
.button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid #2d7ff9;
  border-radius: 6px;
  background: #2d7ff9;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
.button:hover,
a.button:hover {
  background: #1f6de0;
  border-color: #1f6de0;
  text-decoration: none;
}

button:focus,
.button:focus,
a.button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 127, 249, 0.15);
}

.button-secondary,
a.button-secondary {
  background: #fff;
  color: #2d4a68;
  border-color: #c7d3df;
}

.button-secondary:hover,
a.button-secondary:hover {
  background: #f7fafc;
  border-color: #b7c6d5;
}

.button-icon,
a.button-icon {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table thead th {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid #d9e2ec;
  vertical-align: top;
  background: #eef3f8;
  color: #41586d;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table tbody td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #e7edf3;
  vertical-align: top;
}

table tbody tr:nth-child(even) {
  background: #fafcff;
}

table tbody tr:hover {
  background: #f1f6fc;
}

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

.table-action {
  width: 1%;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.02em;
  background: #e8eef5;
  color: #41586d;
}

.status-badge-blue {
  background: #e6f0ff;
  color: #1d5fbf;
}

.status-badge-green {
  background: #e6f6ec;
  color: #1f7a46;
}

.status-badge-amber {
  background: #fff4df;
  color: #9a6700;
}

.status-badge-red {
  background: #fdebec;
  color: #b33a3a;
}

.details dt {
  font-weight: bold;
  margin-top: 12px;
  color: #41586d;
}

.details dd {
  margin: 4px 0 0;
}

.code-block {
  background: #f4f6f8;
  padding: 12px;
  overflow: auto;
  border-radius: 6px;
  border: 1px solid #e1e7ee;
  max-height: 520px;
}

.attachment-page .container {
  width: calc(100% - 32px);
  max-width: none;
}

.attachment-page .page-header {
  display: none;
}

.attachment-view-card {
  width: 100%;
  padding: 12px;
  box-sizing: border-box;
}

.attachment-view-actions {
  margin-bottom: 12px;
}

.attachment-view-meta {
  margin-top: 0;
  margin-bottom: 12px;
}

.pdf-viewer-wrapper {
  width: 100%;
  border: 1px solid #dde3ea;
  border-radius: 6px;
  overflow: hidden;
  background: #f4f6f8;
  box-sizing: border-box;
}

.pdf-viewer {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  display: block;
}

.flashes {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.flash-success {
  background: #e3f7e8;
  border: 1px solid #aee2bb;
}

.flash-error {
  background: #fde8e8;
  border: 1px solid #f5b5b5;
}

ul {
  padding-left: 18px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.pagination-summary {
  margin: 0;
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-link {
  color: #2d7ff9;
  text-decoration: none;
}

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

.pagination-link.disabled {
  color: #999;
  pointer-events: none;
  text-decoration: none;
}

.pagination-current {
  color: #555;
}

.login-page {
  min-height: calc(100vh - 110px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 30px auto;
}

.login-card .button {
  width: 100%;
}

@media (max-width: 900px) {
  .cards-3,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links,
  .nav-actions,
  .searchbar,
  .pagination-bar,
  .pagination-links {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .nav a,
  .nav-action-button {
    display: flex;
    margin: 0;
  }
}
