:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f8;
}

button,
input {
    font: inherit;
}

.page-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding: 8px 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-header-actions form {
    margin: 0;
}

.page-header-actions .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

@media (max-width: 720px) {
    .page-header {
        flex-direction: column;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .button {
        width: 100%;
    }

    .page-header-actions form {
        width: 100%;
    }

    .page-header-actions form .button {
        width: 100%;
    }
}

.eyebrow,
.section-kicker {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 32px;
}

h2 {
    margin-bottom: 0;
    font-size: 20px;
}

.page-description {
    margin-bottom: 0;
    color: #64748b;
}

.panel {
    margin-bottom: 20px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 13px;
    font-weight: 700;
}

.alert {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 10px;
}

.alert-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 16px;
}

.field,
.compact-field {
    display: grid;
    gap: 6px;
}

.field span,
.compact-field span {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
}

input:focus {
    outline: 3px solid rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.form-actions {
    display: flex;
    align-items: end;
}

.button {
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.button-primary {
    background: #1d4ed8;
    color: #ffffff;
}

.button-secondary {
    background: #334155;
    color: #ffffff;
}

.button-use {
    background: #047857;
    color: #ffffff;
}

.button:hover {
    filter: brightness(0.96);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.patient-name {
    font-weight: 700;
    white-space: nowrap;
}

.ticket-form {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(220px, auto) auto;
    align-items: end;
    gap: 12px;
    min-width: 760px;
}

.ticket-form select {
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
}

.ticket-policy-note {
    display: grid;
    gap: 4px;
    min-width: 220px;
    align-self: center;
    white-space: normal;
    line-height: 1.4;
}

.ticket-policy-note strong,
.ticket-policy-note span {
    display: block;
}

.compact-field input {
    min-height: 36px;
    padding: 7px 9px;
}

.use-form {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 240px;
}

.use-form input {
    min-height: 36px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

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

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

.status-neutral {
    background: #e2e8f0;
    color: #334155;
}

.remaining-count {
    font-size: 18px;
    color: #0f172a;
}

.empty-state {
    padding: 28px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
}

.muted {
    color: #94a3b8;
}

@media (max-width: 900px) {
    .page-shell {
        width: min(100% - 20px, 1440px);
        padding-top: 20px;
    }

    .panel {
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions .button {
        width: 100%;
    }
}

/* FC-TFC QR Patient Pass */

.qr-page {
    max-width: 920px;
}

.qr-pass-card {
    text-align: center;
}

.qr-patient-summary {
    display: grid;
    gap: 6px;
    margin: 24px auto 18px;
    font-size: 18px;
}

.qr-image-wrap {
    display: inline-flex;
    padding: 18px;
    margin: 10px auto 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.qr-image {
    width: min(320px, 75vw);
    height: auto;
    display: block;
}

.qr-instruction {
    font-size: 17px;
    font-weight: 700;
}

.qr-security-note {
    max-width: 620px;
    margin: 10px auto;
    color: #64748b;
}

.qr-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.qr-debug {
    margin: 18px auto;
    max-width: 720px;
    text-align: left;
    overflow-wrap: anywhere;
}

.qr-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.qr-info-grid > div {
    display: grid;
    gap: 6px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
}

@media (max-width: 700px) {
    .qr-info-grid {
        grid-template-columns: 1fr;
    }

    .qr-actions {
        flex-direction: column;
    }
}

@media print {
    .page-header,
    .qr-actions,
    .qr-debug {
        display: none !important;
    }

    .qr-pass-card {
        border: 0;
        box-shadow: none;
    }
}


/* Staff Knowledge Center */
.staff-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.staff-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

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

.document-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.document-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.document-card h2 {
    margin: 4px 0 0;
}

.document-category {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #64748b;
}

.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: #64748b;
}

.document-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.document-actions .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

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

.status-draft {
    background: #f1f5f9;
    color: #475569;
}

.button-disabled {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.document-section ul {
    margin-bottom: 0;
}

.document-section li + li {
    margin-top: 8px;
}

@media (max-width: 760px) {
    .staff-page-header {
        flex-direction: column;
    }

    .document-grid {
        grid-template-columns: 1fr;
    }

    .document-actions {
        flex-direction: column;
    }

    .document-actions .button {
        width: 100%;
    }
}

/* FC-TFC Staff Training Viewer */
.training-intro {
    margin-bottom: 24px;
}

.training-slide-list {
    display: grid;
    gap: 28px;
}

.training-slide-card {
    overflow: hidden;
}

.training-slide-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.training-slide-image-wrap {
    width: 100%;
    background: #f5f7fa;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
    overflow: hidden;
}

.training-slide-image {
    display: block;
    width: 100%;
    height: auto;
}

.training-audio-wrap {
    margin-top: 18px;
}

.training-audio-wrap audio {
    display: block;
    width: 100%;
    max-width: 720px;
}

@media (max-width: 720px) {
    .training-slide-heading {
        flex-direction: column;
    }

    .training-slide-list {
        gap: 20px;
    }
}

/* FC-TFC Patient Flyer Viewer */
.flyer-viewer-card {
    max-width: 980px;
    margin: 0 auto;
}

.flyer-image-wrap {
    display: flex;
    justify-content: center;
    padding: 24px;
    background: #eef2f5;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
}

.flyer-image {
    display: block;
    width: 100%;
    max-width: 760px;
    height: auto;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.flyer-viewer-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    color: #667085;
    font-size: 0.9rem;
}

@media (max-width: 720px) {
    .flyer-image-wrap {
        padding: 10px;
    }

    .flyer-viewer-footer {
        flex-direction: column;
        gap: 4px;
    }
}

/* Clinic Compliance authenticated-session controls. */
.compliance-session {
  justify-content: flex-end;
  align-items: center;
  margin: 0 0 12px;
}
.compliance-session form { margin: 0; }
.compliance-session button.compliance-link {
  cursor: pointer;
  background: #1479b8;
  border: 1px solid #0f659c;
  color: #fff;
  font-weight: 700;
}
