@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.css");
@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@500;600;700&display=swap");

:root,
[data-bs-theme=light] {
  --bs-body-bg: #fafafa;
  --bs-body-bg-rgb: 250, 250, 250;
  --bs-tertiary-bg: #ffffff;
  --bs-secondary-bg: #f4f4f4;
  --bs-border-color: #e5e5e5;
  --bs-border-color-translucent: #efefef;
  --bs-body-color: #0a0a0a;
  --bs-body-color-rgb: 10, 10, 10;
  --bs-secondary-color: #737373;
  --bs-secondary-color-rgb: 115, 115, 115;
  --bs-primary: #171717;
  --bs-primary-rgb: 23, 23, 23;
  --bs-primary-text-emphasis: #171717;
  --bs-primary-bg-subtle: #f5f5f5;
  --bs-primary-border-subtle: #e5e5e5;
  --bs-success-rgb: 22, 163, 74;
  --bs-danger-rgb: 220, 38, 38;
  --bs-warning-rgb: 217, 119, 6;
}

body.registry-like {
  margin: 0;
  min-height: 100vh;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont, sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  border-right: 1px solid var(--bs-border-color);
  background: var(--bs-secondary-bg);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 16px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 14px;
}

.workspace-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.workspace-title {
  font-family: "Hanken Grotesk", "Pretendard Variable", sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.05;
}

.workspace-subtitle {
  font-size: 12px;
  color: var(--bs-secondary-color);
}

.sidebar-search {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-search .form-control {
  height: 32px;
  border-radius: 9px;
  background: #fff;
}

.sidebar-plus {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
}

.sidebar-section-label {
  margin: 20px 8px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #a3a3a3;
  text-transform: uppercase;
}

.sidebar-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section-heading .sidebar-section-label {
  margin-bottom: 6px;
}

.sidebar-section-plus {
  width: 24px;
  height: 24px;
  margin: 12px 6px 0 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #737373;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.sidebar-section-plus:hover {
  background: #f5f5f5;
  color: #171717;
}

.sidebar-link,
.sidebar-action,
.sidebar-program-anchor {
  text-decoration: none;
  color: inherit;
}

.sidebar-link,
.sidebar-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  text-align: left;
}

.sidebar-link.active,
.sidebar-action:hover {
  background: #fff;
}

.sidebar-subnav {
  display: grid;
  gap: 4px;
  margin: 4px 0 8px;
  padding-left: 10px;
}

.sidebar-sublink {
  display: block;
  padding: 6px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--bs-secondary-color);
  font-size: 13px;
}

.sidebar-sublink.active {
  background: #fff;
  color: var(--bs-body-color);
}

.sidebar-program-list {
  display: grid;
  gap: 4px;
}

.sidebar-program-item {
  border-radius: 12px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.sidebar-program-item.active {
  background: #fff;
}

.sidebar-program-anchor {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-radius: 10px;
  font-size: 14px;
  min-width: 0;
}

.sidebar-program-anchor strong {
  font-size: 12px;
  color: var(--bs-secondary-color);
}

.sidebar-program-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.mini-icon {
  border: 0;
  background: transparent;
  color: #737373;
  font-size: 12px;
  padding: 2px 4px;
}

.mini-icon.danger {
  color: #b91c1c;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 6px 0;
  border-top: 1px solid var(--bs-border-color);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.user-meta {
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
}

.user-role {
  font-size: 12px;
  color: var(--bs-secondary-color);
}

.sidebar-logout {
  font-size: 12px;
  color: #737373;
  text-decoration: none;
}

.app-main {
  min-width: 0;
  background: #fff;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--bs-border-color);
}

.main-eyebrow {
  font-size: 13px;
  color: var(--bs-secondary-color);
}

.main-header h1 {
  margin: 0;
  font-family: "Hanken Grotesk", "Pretendard Variable", sans-serif;
  font-size: 22px;
  font-weight: 600;
}

.main-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-tools .form-select {
  min-width: 132px;
  height: 36px;
}

.content-surface {
  padding: 0 0 32px;
}

.surface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 12px;
}

.surface-title {
  font-size: 15px;
  font-weight: 600;
}

.surface-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--bs-secondary-color);
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 0 28px 20px;
}

.dashboard-stat-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  background: #fff;
  padding: 16px 18px;
}

.dashboard-stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--bs-secondary-color);
}

.dashboard-stat-value {
  margin-top: 10px;
  font-family: "Hanken Grotesk", "Pretendard Variable", sans-serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

.ticket-table {
  border-top: 1px solid var(--bs-border-color);
}

.ticket-table-react {
  border-top: 1px solid var(--bs-border-color);
}

.settings-shell {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  min-height: calc(100vh - 160px);
  border-top: 1px solid var(--bs-border-color);
}

.settings-nav {
  border-right: 1px solid var(--bs-border-color);
  padding: 22px 16px;
  background: #fff;
}

.settings-nav-label {
  margin: 0 8px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #a3a3a3;
  text-transform: uppercase;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--bs-body-color);
  font-size: 14px;
}

.settings-nav-link.active {
  background: #fafafa;
}

.settings-panel {
  padding: 36px 40px 48px;
}

.settings-panel-header h2 {
  margin: 0;
  font-family: "Hanken Grotesk", "Pretendard Variable", sans-serif;
  font-size: 22px;
  font-weight: 600;
}

.settings-panel-header p {
  margin: 10px 0 0;
  color: var(--bs-secondary-color);
  font-size: 13px;
}

.settings-section-block {
  max-width: 860px;
  padding-top: 28px;
}

.settings-section-table {
  max-width: none;
}

.settings-card-title {
  font-size: 15px;
  font-weight: 600;
}

.settings-card-copy {
  margin-top: 6px;
  color: var(--bs-secondary-color);
  font-size: 13px;
}

.settings-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  max-width: 420px;
}

.settings-actions {
  display: flex;
  justify-content: flex-start;
}

.api-key-highlight {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: #fafafa;
  border: 1px solid var(--bs-border-color);
}

.api-key-highlight-label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

.api-key-highlight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.api-doc-block {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--bs-border-color);
  background: #fafafa;
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
}

.api-keys-table {
  margin-top: 16px;
}

.api-keys-header,
.api-keys-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(260px, 1.8fr) minmax(140px, .9fr) minmax(140px, .9fr) 160px;
  gap: 14px;
  align-items: center;
}

.api-keys-header {
  padding: 12px 0;
  border-bottom: 1px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
  font-size: 12px;
  font-weight: 600;
}

.api-keys-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--bs-border-color);
  font-size: 13px;
}

.api-key-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.api-key-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.api-key-actions form {
  margin: 0;
}

.api-keys-empty {
  padding: 32px 0;
  color: var(--bs-secondary-color);
  font-size: 14px;
}

.ticket-table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bs-border-color);
  background: #fff;
}

.ticket-filter-input,
.ticket-filter-select {
  height: 36px;
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  background: #fff;
  color: var(--bs-body-color);
  font-size: 13px;
}

.ticket-filter-input {
  flex: 1;
  min-width: 240px;
  padding: 0 12px;
}

.ticket-filter-select {
  min-width: 140px;
  padding: 0 12px;
}

.ticket-table-header {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) minmax(90px, .65fr) minmax(220px, 1.2fr) minmax(100px, .65fr) minmax(90px, .55fr) minmax(140px, .8fr) 108px;
  gap: 16px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--bs-border-color);
  background: #fafafa;
}

.ticket-header-cell {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--bs-secondary-color);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: left;
}

.ticket-header-cell.is-sortable {
  cursor: pointer;
}

.ticket-header-cell.ticket-col-actions {
  text-align: right;
}

.ticket-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) minmax(90px, .65fr) minmax(220px, 1.2fr) minmax(100px, .65fr) minmax(90px, .55fr) minmax(140px, .8fr) 108px;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--bs-border-color);
}

.ticket-row-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.ticket-title-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--bs-body-color);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}

.ticket-title-button:hover {
  text-decoration: underline;
}

.ticket-row-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--bs-secondary-color);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #404040;
  font-size: 12px;
  font-weight: 600;
}

.muted-inline {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--bs-secondary-color);
  font-size: 13px;
  line-height: 1.45;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.status-NEW {
  background: #eef2ff;
  color: #4338ca;
}

.status-CHECKING {
  background: #fef3c7;
  color: #92400e;
}

.status-WAITING_CUSTOMER {
  background: #fee2e2;
  color: #991b1b;
}

.status-DONE {
  background: #dcfce7;
  color: #166534;
}

.ticket-col-time {
  font-size: 13px;
  color: var(--bs-secondary-color);
}

.ticket-col-actions {
  text-align: right;
}

.ticket-col-attachments {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-inline-list {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachment-inline-thumb,
.attachment-inline-file {
  flex-shrink: 0;
  text-decoration: none;
}

.attachment-inline-thumb {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--bs-border-color);
  background: #f5f5f5;
}

.attachment-inline-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-inline-file {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #404040;
  font-size: 12px;
  font-weight: 600;
}

.attachment-pill {
  border: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #404040;
  font-size: 12px;
  font-weight: 600;
}

.attachment-pill:hover {
  background: #ededed;
}

.attachment-empty {
  color: var(--bs-secondary-color);
  font-size: 13px;
}

.row-icon-button {
  border: 0;
  background: transparent;
  color: #525252;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
}

.row-icon-button + .row-icon-button {
  margin-left: 6px;
}

.row-icon-button:hover {
  background: #f5f5f5;
  color: #0a0a0a;
}

.row-icon-button.danger {
  color: #991b1b;
}

.row-icon-button.danger:hover {
  background: #fef2f2;
  color: #7f1d1d;
}

.row-icon-button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.empty-lite {
  padding: 48px 28px;
  color: var(--bs-secondary-color);
  font-size: 14px;
}

.ticket-empty {
  padding: 48px 28px;
  color: var(--bs-secondary-color);
  font-size: 14px;
}

.detail-meta-line {
  margin-bottom: 6px;
  color: var(--bs-secondary-color);
  font-size: 13px;
}

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

.detail-item {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--bs-border-color);
  background: #fafafa;
}

.detail-label {
  margin-bottom: 8px;
  color: var(--bs-secondary-color);
  font-size: 12px;
  font-weight: 600;
}

.detail-section {
  margin-top: 20px;
}

.detail-body-text {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--bs-body-color);
}

.detail-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.detail-attachment-card,
.detail-attachment-file {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.detail-attachment-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #f5f5f5;
}

.detail-attachment-card span,
.detail-attachment-file span {
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.detail-empty {
  color: var(--bs-secondary-color);
  font-size: 14px;
}

.notyf {
  z-index: 1080;
}

.notyf__toast {
  width: auto;
  min-width: 320px;
  max-width: 420px;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(10, 10, 10, 0.18);
}

.notyf__wrapper {
  min-height: 56px;
  padding: 14px 48px 14px 16px;
}

.notyf__message {
  flex: 1;
  font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .notyf {
    padding: 12px;
  }

  .notyf__toast {
    min-width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    width: calc(100vw - 24px);
    border-radius: 14px;
  }
}

.modal-content {
  border-radius: 24px;
}

.form-control,
.form-select {
  border-color: var(--bs-border-color);
  border-radius: 12px;
}

.btn-dark {
  --bs-btn-bg: #171717;
  --bs-btn-border-color: #171717;
  --bs-btn-hover-bg: #0a0a0a;
  --bs-btn-hover-border-color: #0a0a0a;
}

.btn-outline-secondary {
  --bs-btn-color: #525252;
  --bs-btn-border-color: #d4d4d4;
  --bs-btn-hover-bg: #f5f5f5;
  --bs-btn-hover-border-color: #d4d4d4;
  --bs-btn-hover-color: #171717;
}

.btn-outline-danger {
  --bs-btn-color: #991b1b;
  --bs-btn-border-color: #fecaca;
  --bs-btn-hover-bg: #fef2f2;
  --bs-btn-hover-border-color: #fecaca;
  --bs-btn-hover-color: #991b1b;
}

.form-control:focus,
.form-select:focus {
  border-color: #d4d4d4;
  box-shadow: 0 0 0 .2rem rgba(23, 23, 23, .06);
}

body.support-app {
  min-height: 100vh;
  background: #fafafa;
  color: var(--bs-body-color);
  font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont, sans-serif;
}

.login-card {
  border: 1px solid var(--bs-border-color) !important;
  box-shadow: 0 18px 60px rgba(10, 10, 10, 0.05) !important;
}

.tracking-wide {
  letter-spacing: .12em;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--bs-border-color);
  }

  .ticket-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ticket-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 20px;
    padding-right: 20px;
  }

  .settings-nav {
    border-right: 0;
    border-bottom: 1px solid var(--bs-border-color);
  }

  .settings-panel {
    padding: 24px 20px 36px;
  }

  .api-keys-header,
  .api-keys-row,
  .api-key-highlight-row,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .api-key-actions {
    justify-content: flex-start;
  }

  .ticket-filter-input,
  .ticket-filter-select {
    width: 100%;
    min-width: 0;
  }

  .ticket-table-header {
    display: none;
  }

  .ticket-col-actions {
    text-align: left;
  }
}
