* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #1f2937;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 220px;
  height: 100vh;
  background: #e9eff8;
  border-right: 1px solid #d8e2f0;
  padding: 20px 14px;
}

.brand {
  font-weight: 700;
  margin-bottom: 20px;
  color: #2f5ea8;
}

.nav-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #cfdaea;
  background: #f5f9ff;
  color: #334155;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn.active, .nav-btn:hover {
  background: #ddeafe;
  border-color: #7ea3d8;
  color: #1d4f91;
}

.content {
  margin-left: 220px;
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.page { display: none; }
.page.show { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.card {
  background: #ffffff;
  border: 1px solid #dce5f1;
  border-radius: 14px;
  padding: 16px;
}

.card h3 { margin: 0 0 8px; color: #64748b; font-size: 14px; }
.card p { margin: 0; font-size: 24px; color: #0f172a; }

.toolbar {
  margin: 10px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-grid > * {
  flex: 0 0 180px;
}

.form-grid > button {
  flex: 0 0 120px;
}

.form-head {
  margin-top: 8px;
  margin-bottom: 0;
}

.form-head span {
  font-size: 12px;
  color: #64748b;
  padding: 0 10px;
}

input,
select {
  background: #ffffff;
  border: 1px solid #ccd8e8;
  color: #1f2937;
  border-radius: 8px;
  padding: 8px 10px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #7ea3d8;
  box-shadow: 0 0 0 3px rgba(126, 163, 216, 0.18);
}

.btn {
  background: #f5f8fd;
  border: 1px solid #c8d8eb;
  color: #1f3f66;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.btn:hover {
  background: #eaf2fc;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn.primary {
  background: #2f6ecb;
  border-color: #2f6ecb;
  color: #ffffff;
}

.btn.primary:hover {
  background: #285ea9;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th, td {
  border-bottom: 1px solid #e6edf5;
  padding: 10px;
  text-align: left;
  font-size: 13px;
  color: #334155;
}

th {
  color: #475569;
  background: #edf3fb;
  position: sticky;
  top: 0;
}

.muted { color: #64748b; margin-right: 8px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.show { display: flex; }

.modal-card {
  width: 320px;
  background: #ffffff;
  border: 1px solid #d7e2ef;
  border-radius: 14px;
  padding: 16px;
}

.modal-card.large {
  width: min(1100px, 92vw);
  max-height: 88vh;
  overflow: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-head h2 {
  margin: 0;
}

.field { margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.error { color: #dc2626; min-height: 20px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.detail-item {
  background: #f8fbff;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  padding: 8px 10px;
}

.detail-item .k {
  color: #64748b;
  font-size: 12px;
}

.detail-item .v {
  font-size: 13px;
  margin-top: 4px;
  word-break: break-all;
  color: #1f2937;
}

.section-title {
  margin: 14px 0 8px;
  color: #334155;
}

.line-list {
  background: #f8fbff;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.line-list div {
  padding: 4px 0;
  border-bottom: 1px dashed #d5e2f2;
}

.line-list div:last-child {
  border-bottom: none;
}
