#modal:has(#glass-order-form),
#modal:has(#glass-order-detail) {
  width: min(860px, calc(100vw - 24px));
  max-width: 860px;
}

.gk-patient-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}

.gk-patient-bar > label {
  flex: 1 1 240px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.gk-patient-bar > label select {
  margin-top: 5px;
}

.gk-patient-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  width: 100%;
  padding-top: 4px;
}

.gk-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: #eef2f6;
  border-radius: 12px;
  margin-bottom: 16px;
}

.gk-tab {
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
  box-shadow: none;
}

.gk-tab:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.gk-tab.active {
  background: #ffffff;
  color: #0d7a6f;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.gk-pane[hidden] {
  display: none !important;
}

.gk-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
  margin-bottom: 14px;
}

.gk-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #e8f3fb 0%, #eaf6f4 100%);
  border-bottom: 1px solid #d5e6ef;
}

.gk-block-head h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #164e70;
  margin: 0;
}

.gk-block-head .text {
  font-size: 12px;
}

.gk-measure-table {
  width: 100%;
  min-width: 0 !important;
  border-collapse: collapse;
  table-layout: fixed;
}

.gk-measure-table th {
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-soft);
  background: #f8fafc;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-soft);
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  line-height: 1.3;
}

.gk-measure-table th:last-child {
  border-right: 0;
}

.gk-measure-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  vertical-align: middle;
}

.gk-measure-table td:last-child {
  border-right: 0;
}

.gk-measure-table tbody tr:last-child td {
  border-bottom: 0;
}

.gk-measure-table td:first-child {
  font-weight: 700;
  color: var(--ink);
  background: #fbfcfd;
  text-align: center;
  width: 82px;
  font-size: 12.5px;
}

.gk-measure-table input {
  width: 100%;
  min-width: 0;
  text-align: center;
  padding: 7px 5px;
  font-size: 13px;
  font-weight: 550;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.gk-pd-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.gk-pd-row .field {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.gk-pd-row .field > span {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

.gk-pd-row input {
  border: 0;
  padding: 2px 0;
  font-size: 16px;
  font-weight: 700;
  border-radius: 0;
  box-shadow: none;
  font-variant-numeric: tabular-nums;
}

.gk-pd-row input:focus {
  box-shadow: none;
}

.gk-pd-row .field:focus-within {
  border-color: var(--teal);
  box-shadow: var(--ring);
}

.gk-lens-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 14px;
}

.gk-lens-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}

.gk-lens-chip:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.gk-lens-chip[aria-pressed="true"] {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e3a8a;
  font-weight: 650;
}

.gk-lens-chip .gk-chip-check {
  font-size: 13px;
  font-weight: 800;
  display: none;
}

.gk-lens-chip[aria-pressed="true"] .gk-chip-check {
  display: inline;
}

/* Printed ĐƠN KÍNH layout matching sample */
#glass-order-detail .gk-sheet {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.gk-sheet {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.48;
}

.gk-print-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid #1b5e9e;
}

.gk-print-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

.gk-print-clinic {
  text-align: right;
  line-height: 1.45;
}

.gk-print-clinic b {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #164e87;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.gk-print-clinic p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #334155;
}

.gk-print-title-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 14px 0 12px;
  min-height: 36px;
}

.gk-print-title-row h1 {
  margin: 0 !important;
  font-size: 22px !important;
  font-weight: 800;
  color: #1b5e9e;
  letter-spacing: 0.04em;
  text-align: center;
}

.gk-print-number {
  position: absolute;
  right: 0;
  top: 0;
  text-align: right;
  line-height: 1.2;
}

.gk-print-number span {
  display: block;
  font-size: 11px;
  color: #475569;
}

.gk-print-number b {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.gk-print-patient {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 5px 24px;
  padding: 6px 0 10px;
  border-bottom: 1px solid #cbd5e1;
  font-size: 13px;
}

.gk-print-patient div {
  overflow-wrap: anywhere;
}

.gk-print-section-title {
  font-size: 13.5px !important;
  font-weight: 700;
  color: #0f172a;
  margin: 12px 0 6px !important;
}

.gk-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.gk-print-table th,
.gk-print-table td {
  border: 1px solid #cbd5e1 !important;
  padding: 6px 7px !important;
  text-align: center !important;
  vertical-align: middle;
}

.gk-print-table th {
  background: #edf2f7 !important;
  font-weight: 700;
  font-size: 11.5px;
  color: #1e293b;
}

.gk-print-table td:first-child {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.gk-pd-cell {
  white-space: nowrap;
  font-weight: 400;
}

.gk-types-box {
  border: 1.5px solid #475569;
  border-radius: 10px;
  padding: 10px 16px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.gk-types-col b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #0f172a;
}

.gk-type-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  margin: 4px 0;
  color: #1e293b;
}

.gk-check-svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.gk-print-note {
  margin: 10px 0 0 !important;
  font-size: 12.5px;
  color: #1e293b;
  white-space: pre-wrap;
}

.gk-print-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 22px;
  gap: 20px;
}

.gk-print-delivered {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  padding-top: 48px;
}

.gk-print-sign {
  text-align: center;
  min-width: 210px;
  font-size: 12.5px;
  margin-left: auto;
}

.gk-print-sign span {
  display: block;
  font-style: italic;
  color: #334155;
  margin-bottom: 3px;
}

.gk-print-sign b {
  display: block;
  font-size: 13.5px;
  color: #0f172a;
}

.gk-print-sign .gk-sign-name {
  margin-top: 44px;
  font-weight: 600;
  color: #1e293b;
  font-style: normal;
}

@media (max-width: 680px) {
  .gk-measure-table td:first-child {
    width: 52px;
    font-size: 11px;
    padding: 4px 2px;
  }
  .gk-measure-table th {
    font-size: 10px;
    padding: 7px 2px;
  }
  .gk-measure-table td {
    padding: 5px 2px;
  }
  .gk-measure-table input {
    padding: 6px 2px;
    font-size: 12px;
  }
  .gk-pd-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .gk-pd-row .field {
    padding: 8px 9px;
  }
  .gk-pd-row .field > span {
    font-size: 10.5px;
  }
  .gk-print-patient,
  .gk-types-box {
    grid-template-columns: 1fr;
  }
  .gk-print-title-row {
    padding-right: 60px;
  }
}
