* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f8fb;
  color: #16202a;
}
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
h1, h2, h3 {
  margin: 0 0 10px;
  color: #13395c;
}
.panel, .sub-panel {
  background: #fff;
  border: 1px solid #cfdde8;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}
.panel.narrow {
  max-width: 760px;
  margin: 0 auto;
}
.stack-form, .inline-form, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.compact {
  gap: 8px;
}
.stack-form {
  flex-direction: column;
  align-items: stretch;
}
.stack-form label, .inline-form label, .filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}
.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
input, select, button {
  font: inherit;
}
input, select {
  min-height: 38px;
  border: 1px solid #a9bfd0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}
button, .button-link {
  min-height: 38px;
  border: 1px solid #1c5f97;
  background: #2f6fab;
  color: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
button.ghost, .ghost-link {
  background: #eef4f8;
  color: #18466d;
  border-color: #9fb8cb;
}
button.danger {
  background: #b63a3a;
  border-color: #8e2c2c;
}
.danger-form {
  margin-left: 0;
}
.top-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.top-stats {
  font-weight: 700;
  color: #12324a;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.tab-link {
  padding: 10px 14px;
  border-radius: 6px;
  text-decoration: none;
  color: #18466d;
  background: #e7f0f6;
  border: 1px solid #c4d7e4;
  font-weight: 600;
}
.tab-link.active {
  background: #2f6fab;
  color: #fff;
  border-color: #1c5f97;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.mini-card {
  border: 1px solid #d9e6ef;
  border-radius: 8px;
  background: #f9fcff;
  padding: 12px;
}
.mini-title {
  font-size: 13px;
  color: #5b6d7d;
  margin-bottom: 6px;
}
.mini-value {
  font-size: 18px;
  font-weight: 700;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e1ebf2;
  vertical-align: top;
}
th {
  background: #d9e8f2;
  color: #1f2d3d;
}
th a {
  color: inherit;
  text-decoration: none;
}
.active-row td {
  background: #f5fbff;
}
.rank-break td {
  border-top: 16px solid #fff;
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 700;
}
.badge-red {
  background: #f8d7da;
  color: #7a1f27;
}
.badge-orange {
  background: #ffe5c2;
  color: #8a4b08;
}
.badge-green {
  background: #d4edda;
  color: #1f5f35;
}
.badge-blue {
  background: #d8e9fb;
  color: #18466d;
}
.flash {
  margin-bottom: 10px;
  border-radius: 6px;
  padding: 10px 12px;
}
.flash-error {
  border: 1px solid #f1c6cb;
  background: #fce8ea;
  color: #7a1f27;
}
.flash-success {
  border: 1px solid #bfdac6;
  background: #e8f6ec;
  color: #1f5f35;
}
.flash-info {
  border: 1px solid #cbdce9;
  background: #edf5fb;
  color: #18466d;
}
.muted, .empty {
  color: #637282;
}
.login-shell {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.scroll-hint {
  color: #5e7183;
  font-size: 14px;
}
.sheet-card {
  border: 1px solid #d8e4ed;
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
  max-height: 72vh;
  overflow: auto;
}
.sheet-section + .sheet-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e0eaf1;
}
.sheet-row, .sheet-status-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 12px;
  padding: 4px 0;
  align-items: start;
}
.sheet-status-grid {
  display: grid;
  gap: 8px;
}
.sheet-label {
  font-weight: 700;
  color: #1b4465;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.block-actions {
  gap: 10px;
}
.check-row {
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
}
@media (max-width: 840px) {
  .topbar {
    flex-direction: column;
  }
  .top-links {
    align-items: flex-start;
  }
  .sheet-row, .sheet-status-row {
    grid-template-columns: 1fr;
  }
}
