/* Facility */
.facility-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.tab-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #bdcce0;
  color: #24436f;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn:hover,
.tab-btn:focus-visible {
  background: #eef4fc;
}

.tab-btn.is-active {
  background: #1f467b;
  border-color: #1f467b;
  color: #fff;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
}

.search-row input,
.search-row select {
  height: 44px;
  border-radius: 10px;
  border: 1px solid #bfcde0;
  background: #fff;
  color: #1d3459;
  padding: 0 12px;
  font-size: 0.93rem;
}

.search-row input:focus,
.search-row select:focus {
  outline: 2px solid #82a8db;
  outline-offset: 1px;
}

/* Sub pages */
.page-hero {
  padding: 44px 0;
  background: linear-gradient(180deg, #f4f8fe 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border);
}

.page-hero h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  letter-spacing: -0.02em;
}

.page-hero p {
  margin: 10px 0 0;
  color: var(--text-muted);
}

.breadcrumb {
  margin-bottom: 10px;
  color: #4d6184;
  font-size: 0.9rem;
}

.page-section + .page-section {
  margin-top: 16px;
}

.split-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.basic-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.basic-table th,
.basic-table td {
  border-bottom: 1px solid #e8eef8;
  text-align: left;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.basic-table th {
  background: #f4f8ff;
  color: #1d3660;
  font-weight: 700;
}

.basic-table tbody tr:hover {
  background: #f8fbff;
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel h3 {
  margin: 0;
  font-size: 1.04rem;
}

.panel p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.login-form {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  color: #23395f;
  font-size: 0.9rem;
  font-weight: 700;
}

.form-row input {
  height: 42px;
  border: 1px solid #c2cfe2;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.93rem;
}

.form-row input:focus {
  outline: 2px solid #8eb0da;
  outline-offset: 1px;
}

.form-help {
  margin: -2px 0 0;
  color: #536584;
  font-size: 0.84rem;
}

.auth-message {
  margin: 0;
  min-height: 22px;
  font-size: 0.88rem;
  color: #1a4e86;
}

.auth-message.is-error {
  color: #a52d25;
}

.auth-message.is-success {
  color: #136a43;
}

.login-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-help-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.login-help-actions .text-link {
  font-size: 0.86rem;
}

.login-actions .btn[disabled],
.login-help-actions .text-link-button[disabled] {
  opacity: 0.68;
  cursor: not-allowed;
}

.mypage-grid {
  grid-template-columns: 1.4fr 1fr;
}

.mypage-greeting {
  margin-top: 10px;
  font-weight: 700;
  color: #213b66;
}

.mypage-summary-list {
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.mypage-summary-list div {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dbe4f2;
  border-radius: 10px;
  background: #f8fbff;
}

.mypage-summary-list dt {
  color: #3f567b;
  font-size: 0.84rem;
  font-weight: 700;
}

.mypage-summary-list dd {
  margin: 0;
  color: #1f3356;
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-all;
}

.mypage-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mypage-edit-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mypage-edit-panel {
  padding: 14px;
}

.mypage-edit-panel h4 {
  margin: 0 0 10px;
  color: #233f68;
  font-size: 0.96rem;
}

.mypage-edit-panel .btn {
  margin-top: 10px;
}

.surname-search-panel {
  display: grid;
  gap: 12px;
  max-width: 860px;
  width: 100%;
  margin-inline: auto;
}

.surname-search-controls {
  display: grid;
  grid-template-columns: minmax(420px, 720px) auto;
  gap: 10px;
  align-items: end;
}

.surname-search-controls .form-row {
  margin-bottom: 0;
}

.surname-search-controls input,
.surname-search-controls select {
  width: 100%;
  height: 42px;
  border: 1px solid #c2cfe2;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.93rem;
  background: #fff;
}

.surname-search-controls input:focus,
.surname-search-controls select:focus {
  outline: 2px solid #8eb0da;
  outline-offset: 1px;
}

.surname-search-controls .btn {
  height: 42px;
  padding: 0 16px;
  font-size: 0.9rem;
  border-radius: 10px;
  justify-self: start;
}

/* Age calc */
.age-calc-panel {
  max-width: 860px;
  width: 100%;
  margin-inline: auto;
}

.age-calc-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.age-form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.age-form-col > label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #4f678f;
}

.age-form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.age-form-row label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #2f4a72;
  white-space: nowrap;
  flex-shrink: 0;
}

.age-form-row input[type="number"] {
  width: 130px;
  flex-shrink: 0;
  height: 42px;
  border: 1px solid #c2cfe2;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 1rem;
  background: #fff;
  color: #1a2e4a;
}

.age-form-row input[type="number"]:focus {
  outline: none;
  border-color: #1f5bb6;
  box-shadow: 0 0 0 3px rgba(31, 91, 182, 0.12);
}

.age-form-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.age-form-error {
  font-size: 0.85rem;
  color: #c0392b;
  min-height: 1.2em;
  margin: 0;
  padding-left: 2px;
}

.age-result-wrap {
  margin-top: 20px;
  border: 1px solid #dbe3f1;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.age-result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.age-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 22px 16px;
  border-right: 1px solid #edf1f8;
}

.age-result-card:last-child {
  border-right: 0;
}

.age-card-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4f678f;
  letter-spacing: 0.02em;
}

.age-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: #1a3a6e;
  line-height: 1.1;
}

.age-card-note {
  font-size: 0.76rem;
  color: #8fa3c0;
}

.age-result-formula {
  padding: 10px 18px;
  font-size: 0.82rem;
  color: #6b83a6;
  background: #f6f9fe;
  margin: 0;
  border-top: 1px solid #edf1f8;
  line-height: 1.7;
}

.age-table-section {
  margin-top: 28px;
}

.age-table-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #2f4a72;
  margin: 0 0 10px;
}

.age-table-wrap {
  border: 1px solid #dbe3f1;
  border-radius: 12px;
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
}

.age-table thead th {
  position: sticky;
  top: 0;
  background: #f3f7fd;
  z-index: 1;
  font-size: 0.88rem;
}

.age-table tbody tr.age-row-highlight {
  background: #fff7ed;
  font-weight: 700;
}

.age-table tbody tr.age-row-highlight td {
  color: #c05a00;
}

/* Ganji */
.ganji-panel {
  max-width: 860px;
  width: 100%;
  margin-inline: auto;
}

.ganji-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ganji-search-row input[type="date"] {
  min-width: 190px;
  height: 40px;
  border: 1px solid #c2cfe2;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.92rem;
  background: #fff;
  color: #1a2e4a;
}

.ganji-search-row input[type="date"]:focus {
  outline: none;
  border-color: #1f5bb6;
  box-shadow: 0 0 0 3px rgba(31, 91, 182, 0.12);
}

.ganji-nav-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.ganji-error {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: #c0392b;
}

.ganji-cards {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.ganji-card {
  border: 1px solid #dbe3f1;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

.ganji-card.is-center {
  border: 2px solid #1f5bb6;
  background: #f8fbff;
}

.ganji-card-date {
  margin: 0 0 10px;
  color: #1f3658;
  font-size: 1rem;
}

.ganji-line {
  margin: 6px 0;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  font-size: 0.92rem;
}

.ganji-line > span {
  color: #5c7398;
}

.ganji-line > strong {
  color: #243c60;
  font-weight: 600;
}

.surname-result-meta {
  margin: 0;
  color: #4f678f;
  font-size: 0.92rem;
}

.surname-list-wrap {
  border: 1px solid #dbe3f1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.surname-list-header,
.surname-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(120px, 1.4fr);
  align-items: center;
  gap: 0;
}

.surname-list-header {
  background: #f3f7fd;
  border-bottom: 1px solid #dbe3f1;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #36527d;
}

.surname-list-header > span {
  padding: 0 4px;
}

.surname-row {
  padding: 8px 12px;
  border-bottom: 1px solid #e8edf5;
  font-size: 0.94rem;
  line-height: 1.45;
}

.surname-row:last-child {
  border-bottom: 0;
}

.surname-row:nth-child(even) {
  background: #fbfdff;
}

.surname-row:hover {
  background: #f0f5fc;
}

.surname-cell {
  padding: 0 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surname-cell-hanja {
  display: flex;
  align-items: center;
  gap: 8px;
}

.surname-hanja-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surname-copy-btn {
  border: 1px solid #c7d5ea;
  background: #f5f9ff;
  color: #2d4a74;
  border-radius: 8px;
  height: 28px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.surname-copy-btn:hover,
.surname-copy-btn:focus-visible {
  background: #eaf2ff;
}

.surname-empty-cell {
  color: #5f7397;
  padding: 16px;
  text-align: center;
}

.surname-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.surname-page-btn {
  border: 1px solid #cbd8ea;
  background: #fff;
  color: #2e4b74;
  border-radius: 8px;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.surname-page-btn:hover:not(:disabled),
.surname-page-btn:focus-visible:not(:disabled) {
  background: #eef3fb;
}

.surname-page-btn.is-active {
  border-color: #1f5bb6;
  background: #1f5bb6;
  color: #fff;
}

.surname-page-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.kpi-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi-box {
  border: 1px solid #d6e1f1;
  border-radius: 12px;
  background: #f7fbff;
  padding: 12px;
}

.kpi-box strong {
  display: block;
  font-size: 1.15rem;
}

.kpi-box span {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: #4e6181;
}

@media (max-width: 980px) {
  .split-grid {
    grid-template-columns: 1fr;
  }

  .mypage-edit-grid {
    grid-template-columns: 1fr;
  }

  .login-actions,
  .mypage-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-actions .btn,
  .mypage-actions .btn,
  .mypage-actions a {
    width: 100%;
  }

  .surname-search-controls {
    grid-template-columns: 1fr;
  }

  .surname-list-header,
  .surname-row {
    grid-template-columns: minmax(60px, 0.75fr) minmax(60px, 0.75fr) minmax(0, 1.5fr);
    padding: 6px 10px;
    gap: 4px;
  }

  .surname-list-header {
    font-size: 0.78rem;
  }

  .surname-row {
    font-size: 0.82rem;
  }

  .age-form-row {
    flex-wrap: nowrap;
  }

  .age-form-row input[type="number"] {
    flex: 1;
    width: auto;
    min-width: 80px;
  }

  .age-form-btns {
    flex-shrink: 0;
  }

  .age-result-card {
    padding: 16px 10px;
  }

  .age-card-value {
    font-size: 1.6rem;
  }

  .ganji-search-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ganji-search-row input[type="date"] {
    grid-column: 1 / -1;
  }

  .ganji-nav-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ganji-line {
    grid-template-columns: 84px 1fr;
    font-size: 0.86rem;
  }
}

@media (min-width: 981px) {
  .surname-search-panel {
    gap: 14px;
  }

  .surname-result-meta {
    font-size: 0.95rem;
    font-weight: 600;
  }

  .surname-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef3fb;
    border-bottom: 1px solid #ccd9ec;
  }

  .surname-table tbody td {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .surname-table td:nth-child(2),
  .surname-table td:nth-child(3) {
    white-space: normal;
    word-break: keep-all;
  }

  .surname-table th:nth-child(1),
  .surname-table td:nth-child(1) {
    width: 24%;
  }

  .surname-table th:nth-child(2),
  .surname-table td:nth-child(2) {
    width: 30%;
  }

  .surname-table th:nth-child(3),
  .surname-table td:nth-child(3) {
    width: 46%;
  }
}

@media (max-width: 680px) {
  .search-row {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }
}
