@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@400;600;700&family=Oswald:wght@500;600&display=swap");

:root {
  --db-bg: #f6f9fc;
  --db-paper: rgba(255, 255, 255, 0.96);
  --db-line: rgba(92, 66, 44, 0.18);
  --db-ink: #2b1f17;
  --db-muted: #6f6358;
  --db-accent: #f18f01;
  --db-accent-deep: #f18f01;
  --db-accent-soft: #d8c0b0;
  --db-success: #2d7d58;
  --db-error: #b14e43;
  --db-warning: #be7a2f;
  --db-shadow: 0 22px 56px rgba(91, 63, 41, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans KR", "Malgun Gothic", sans-serif;
  color: var(--db-ink);
}

body {
  background: linear-gradient(180deg, #f4f7fb 0%, #e9eef5 100%);
}

.db-manager-page {
  min-height: 100vh;
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.card,
.subcard {
  border: 1px solid var(--db-line);
  border-radius: 0;
  background: var(--db-paper);
  box-shadow: var(--db-shadow);
  backdrop-filter: blur(12px);
}

.db-manager-hero,
.db-toolbar,
.company-panel {
  padding: 14px 16px;
}

.db-manager-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.db-manager-hero h1,
.company-head h2 {
  margin: 0;
  font-family: "Oswald", "IBM Plex Sans KR", sans-serif;
  letter-spacing: 0.02em;
}

.db-manager-hero h1 {
  font-family: "IBM Plex Sans KR", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.home-link,
button,
input,
select {
  font: inherit;
}

.home-link,
button {
  border-radius: 14px;
}

.home-link,
.ghost-button,
.primary-button,
.toolbar-actions button,
.action-row button {
  border: 1px solid transparent;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.home-link,
.ghost-button,
.toolbar-actions button {
  background: rgba(255, 255, 254, 0.98);
  color: #a3493d;
  border-color: rgba(163, 73, 61, 0.28);
}

.primary-button {
  background: linear-gradient(135deg, var(--db-accent) 0%, var(--db-accent-deep) 100%);
  color: #fffaf5;
}

.home-link:hover,
.ghost-button:hover,
.toolbar-actions button:hover,
.primary-button:hover,
.action-row button:hover {
  transform: translateY(-1px);
}

.home-link:hover,
.ghost-button:hover,
.toolbar-actions button:hover {
  background: #a3493d;
  border-color: #a3493d;
  color: #fff7f0;
}

button:disabled,
button[aria-busy="true"] {
  opacity: 0.66;
  transform: none;
}

button:disabled {
  cursor: not-allowed;
}

button[aria-busy="true"] {
  cursor: wait;
}

.db-toolbar {
  display: grid;
  gap: 10px;
}

.db-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-path-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(101, 75, 52, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 11px 13px;
  min-height: 46px;
}

.db-path-input:focus {
  outline: none;
  border-color: rgba(139, 87, 66, 0.55);
  box-shadow: 0 0 0 4px rgba(139, 87, 66, 0.12);
}

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

.field-grid-search {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.import-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-inline span {
  white-space: nowrap;
  margin: 0;
}

.field-inline select,
.field-inline input {
  flex: 1 1 auto;
  min-width: 0;
}

.import-kind-field {
  flex: 0 0 280px;
}

.import-period-year-field,
.import-period-month-field {
  flex: 0 0 160px;
}

.import-file-field {
  flex: 1 1 auto;
}

.import-row .import-button {
  margin-left: auto;
  flex: 0 0 auto;
}

.search-kind-field {
  flex: 0 0 240px;
}

.search-query-field {
  flex: 1 1 auto;
}

.search-yearmonth-field {
  flex: 0 0 170px;
}

.search-limit-field {
  flex: 0 0 130px;
}

.search-row .search-button {
  margin-left: auto;
  flex: 0 0 auto;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--db-muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid rgba(101, 75, 52, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 11px 13px;
  min-height: 46px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(139, 87, 66, 0.55);
  box-shadow: 0 0 0 4px rgba(139, 87, 66, 0.12);
}

.field-wide {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.import-hint {
  margin-top: 10px;
  color: var(--db-muted);
  font-size: 13px;
  line-height: 1.6;
}

.toolbar-actions,
.action-row,
.section-head,
.company-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.status-box {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(119, 95, 78, 0.08);
  color: var(--db-muted);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.status-box.is-success {
  background: rgba(45, 125, 88, 0.12);
  color: var(--db-success);
}

.status-box.is-error {
  background: rgba(177, 78, 67, 0.12);
  color: var(--db-error);
}

.status-box.is-warning {
  background: rgba(190, 122, 47, 0.12);
  color: var(--db-warning);
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.company-head {
  margin-bottom: 18px;
}

.panel-stack {
  display: grid;
  gap: 14px;
}

.subcard {
  padding: 18px;
}

.subcard h3 {
  margin: 0;
  font-size: 19px;
}

.yearmonth-grid,
.master-count-grid {
  display: grid;
  gap: 12px;
}

.yearmonth-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.master-count-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.yearmonth-card,
.master-count-card {
  border: 1px solid rgba(109, 64, 48, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.mini-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mini-head h4 {
  margin: 0;
  font-size: 15px;
}

.checkbox-list {
  display: grid;
  gap: 7px;
  max-height: 180px;
  overflow: auto;
  padding-right: 6px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--db-ink);
  font-size: 14px;
}

.empty-text {
  color: var(--db-muted);
  font-size: 13px;
}

.count-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--db-accent-deep);
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(109, 64, 48, 0.12);
  background: rgba(255, 255, 255, 0.76);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.result-table th,
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(109, 64, 48, 0.1);
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.result-table th {
  position: sticky;
  top: 0;
  background: #f8f0e8;
  z-index: 1;
}

.missing-report {
  margin: 0;
  min-height: 84px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(109, 64, 48, 0.12);
  font-family: "IBM Plex Sans KR", "Malgun Gothic", sans-serif;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

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

  .yearmonth-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .db-manager-page {
    padding: 18px 14px 20px;
  }

  .db-manager-hero,
  .db-toolbar,
  .company-panel,
  .subcard {
    padding: 18px;
  }

  .db-manager-hero,
  .company-head,
  .section-head,
  .action-row,
  .mini-head {
    flex-direction: column;
    align-items: stretch;
  }

  .db-toolbar-row,
  .toolbar-actions,
  .import-row,
  .search-row,
  .field-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .yearmonth-grid,
  .master-count-grid {
    grid-template-columns: 1fr;
  }

  .home-link,
  .ghost-button,
  .primary-button,
  .toolbar-actions button,
  .action-row button,
  .db-path-input,
  .import-kind-field,
  .import-period-year-field,
  .import-period-month-field,
  .import-file-field,
  .search-kind-field,
  .search-query-field,
  .search-yearmonth-field,
  .search-limit-field {
    width: 100%;
  }

  .import-row .import-button,
  .search-row .search-button {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .db-manager-page {
    padding: 14px 10px 18px;
    gap: 14px;
  }

  .db-manager-hero h1 {
    font-size: clamp(38px, 10vw, 52px);
    line-height: 1.05;
  }

  .home-link,
  .ghost-button,
  .primary-button,
  .toolbar-actions button,
  .action-row button,
  .db-path-input,
  .field input,
  .field select {
    min-height: 48px;
    font-size: 16px;
  }

  .field span,
  .import-hint,
  .empty-text,
  .missing-report,
  .status-box {
    font-size: 15px;
  }

  .subcard h3,
  .company-head h2 {
    font-size: 22px;
  }

  .mini-head h4,
  .checkbox-item {
    font-size: 16px;
  }

  .count-value {
    font-size: 32px;
  }

  .result-table th {
    font-size: 14px;
  }

  .result-table td {
    font-size: 15px;
    line-height: 1.5;
  }
}

@media (max-width: 720px) {
  .db-manager-hero {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .db-manager-hero .hero-actions {
    margin-left: auto;
    flex: 0 0 auto;
  }

  .db-manager-hero .home-link {
    width: auto;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }
}

/* 2026-04-23 unify db manager hero with purchase header */
.db-manager-hero {
  position: relative !important;
  overflow: hidden !important;
  min-height: 0 !important;
  padding: 24px 16px 14px !important;
  align-items: flex-end !important;
}

.db-manager-hero::before {
  content: "" !important;
  position: absolute !important;
  top: 12px !important;
  left: 16px !important;
  right: 16px !important;
  height: 1px !important;
  background: rgba(241, 143, 1, 0.34) !important;
}

.db-manager-hero h1 {
  color: #f18f01 !important;
  font-family: "IBM Plex Sans KR", "Helvetica Neue", Arial, sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
  font-size: clamp(24px, 3vw, 36px) !important;
  line-height: 1.02 !important;
}

/* 2026-04-28 align DB manager with purchase page */
:root {
  --db-bg: #b8b8b8;
  --db-paper: rgba(255, 255, 252, 0.92);
  --db-line: rgba(89, 73, 55, 0.22);
  --db-ink: #161411;
  --db-muted: rgba(22, 20, 17, 0.58);
  --db-accent: #f18f01;
  --db-accent-deep: #f18f01;
  --db-accent-soft: rgba(241, 143, 1, 0.08);
  --db-shadow: 0 16px 28px rgba(82, 60, 46, 0.12);
}

html,
body {
  font-family: "IBM Plex Sans KR", "Malgun Gothic", "Segoe UI", sans-serif !important;
  color: var(--db-ink) !important;
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(180deg, #c2c2c2 0%, #b6b6b6 100%) !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 100%);
  background-size: 110px 110px;
}

.db-manager-page {
  position: relative;
  width: min(1880px, calc(100vw - 16px)) !important;
  margin: 0 auto;
  padding: 8px !important;
  gap: 10px !important;
}

.db-manager-page.portal-wide-frame {
  width: min(1880px, calc(100vw - 8px)) !important;
}

.db-manager-page,
.db-toolbar,
.db-toolbar-row,
.company-grid,
.company-panel,
.panel-stack,
.subcard,
.import-row,
.search-row,
.field,
.field-inline,
.import-file-field,
.search-query-field,
.table-wrap,
.status-box,
.missing-report {
  min-width: 0;
}

.db-toolbar-row,
.import-row,
.search-row {
  flex-wrap: wrap;
}

.status-box,
.missing-report,
.result-table th,
.result-table td {
  overflow-wrap: anywhere;
}

.company-grid {
  gap: 12px !important;
}

.company-panel {
  min-width: 0 !important;
}

.import-kind-field {
  flex-basis: 220px !important;
}

.import-period-year-field,
.import-period-month-field {
  flex-basis: 118px !important;
}

.search-kind-field {
  flex-basis: 190px !important;
}

.search-yearmonth-field {
  flex-basis: 128px !important;
}

.search-limit-field {
  flex-basis: 92px !important;
}

.card,
.subcard,
.yearmonth-card,
.master-count-card,
.table-wrap,
.missing-report {
  border: 1px solid rgba(89, 73, 55, 0.18) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.42) !important;
  box-shadow: 0 16px 28px rgba(82, 60, 46, 0.12) !important;
  backdrop-filter: none !important;
}

.db-manager-hero,
.db-toolbar,
.company-panel {
  background: linear-gradient(180deg, #ffffff, #f9fbfd) !important;
}

.subcard,
.yearmonth-card,
.master-count-card {
  box-shadow: none !important;
}

.db-manager-hero {
  border: 1px solid rgba(89, 73, 55, 0.22) !important;
  box-shadow: 0 16px 28px rgba(82, 60, 46, 0.12) !important;
}

.db-manager-hero h1,
.company-head h2,
.section-head h3,
.subcard h3,
.mini-head h4 {
  font-family: "IBM Plex Sans KR", "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: -0.02em !important;
  color: #5f5650 !important;
  font-weight: 600 !important;
}

.db-manager-hero h1 {
  color: #f18f01 !important;
}

.company-head h2 {
  font-size: clamp(18px, 1.5vw, 24px) !important;
}

.subcard h3 {
  font-size: clamp(16px, 1.25vw, 20px) !important;
}

.field span,
.import-hint,
.empty-text,
.status-box,
.checkbox-item,
.result-table th,
.count-value {
  font-family: "IBM Plex Sans KR", "Malgun Gothic", "Segoe UI", sans-serif !important;
}

.field span {
  color: rgba(22, 20, 17, 0.58) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.import-hint,
.empty-text {
  color: rgba(22, 20, 17, 0.58) !important;
}

.home-link,
.ghost-button,
.primary-button,
.toolbar-actions button,
.action-row button,
input[type="file"]::file-selector-button {
  border: 1px solid rgba(241, 143, 1, 0.32) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 254, 0.98) !important;
  color: #f18f01 !important;
  box-shadow: none !important;
  font-weight: 700 !important;
}

.primary-button {
  background: #f18f01 !important;
  border-color: #f18f01 !important;
  color: #fffaf1 !important;
}

.home-link:hover,
.ghost-button:hover,
.primary-button:hover,
.toolbar-actions button:hover,
.action-row button:hover,
input[type="file"]::file-selector-button:hover {
  background: #f18f01 !important;
  border-color: #f18f01 !important;
  color: #fffaf1 !important;
  transform: translateY(-1px);
}

.db-path-input,
.field input,
.field select {
  border: 1px solid rgba(89, 73, 55, 0.18) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.66) !important;
  color: #161411 !important;
  box-shadow: none !important;
}

.db-path-input:focus,
.field input:focus,
.field select:focus {
  border-color: rgba(241, 143, 1, 0.48) !important;
  box-shadow: 0 0 0 3px rgba(241, 143, 1, 0.08) !important;
}

.status-box {
  border: 1px solid rgba(241, 143, 1, 0.16) !important;
  border-radius: 0 !important;
  background: rgba(241, 143, 1, 0.08) !important;
  color: #a56a10 !important;
}

.status-box.is-success {
  border-color: rgba(63, 122, 74, 0.2) !important;
  background: rgba(63, 122, 74, 0.08) !important;
  color: #3f7a4a !important;
}

.status-box.is-error {
  border-color: rgba(174, 75, 65, 0.2) !important;
  background: rgba(174, 75, 65, 0.08) !important;
  color: #ae4b41 !important;
}

.status-box.is-warning {
  border-color: rgba(168, 117, 33, 0.18) !important;
  background: rgba(168, 117, 33, 0.08) !important;
  color: #a87521 !important;
}

.result-table th {
  background: rgba(241, 143, 1, 0.07) !important;
  color: rgba(22, 20, 17, 0.62) !important;
  font-weight: 800 !important;
}

.result-table th,
.result-table td {
  border-bottom: 1px solid rgba(89, 73, 55, 0.12) !important;
}

.count-value {
  color: #f18f01 !important;
}
