* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #172033;
    background: #f4f6f8;
    font-family: "Microsoft JhengHei", Arial, sans-serif;
}

.shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: white;
    padding: 22px 18px;
}

.brand {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
}

.language-picker {
    display: grid;
    gap: 6px;
    margin: -10px 0 18px;
    color: #cbd5e1;
    font-size: 13px;
}

.language-picker select,
.customer-language-picker select {
    min-width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    font: inherit;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar a,
.ghost {
    display: block;
    width: 100%;
    color: #e5e7eb;
    background: transparent;
    border: 0;
    border-radius: 6px;
    padding: 11px 12px;
    text-align: left;
    text-decoration: none;
    font: inherit;
}

.sidebar a:hover,
.ghost:hover {
    background: #1f2937;
}

.ghost {
    margin-top: 28px;
    cursor: pointer;
}

.content {
    padding: 28px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header.compact {
    align-items: center;
    margin-bottom: 14px;
}

h1,
h2,
p {
    margin-top: 0;
}

.page-header p {
    color: #667085;
}

.panel,
.metric {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric span {
    display: block;
    color: #667085;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 30px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.permission-module {
    border-top: 1px solid #e5e7eb;
    padding: 16px 0;
}

.permission-module h3 {
    margin: 0 0 12px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}

.permission-item {
    align-items: flex-start;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    padding: 10px;
}

.permission-item input {
    min-height: auto;
    width: auto;
}

.permission-item strong,
.permission-item small {
    display: block;
}

.permission-item small {
    color: #667085;
}

.form-actions {
    margin-top: 18px;
}

.quick-actions a,
button {
    border: 0;
    border-radius: 6px;
    background: #2563eb;
    color: white;
    cursor: pointer;
    display: inline-block;
    font: inherit;
    padding: 10px 14px;
    text-decoration: none;
}

button:hover,
.quick-actions a:hover {
    background: #1d4ed8;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    align-items: end;
}

.form-grid.wide {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.span-2 {
    grid-column: span 2;
}

label {
    display: grid;
    gap: 6px;
    color: #344054;
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 42px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    color: #172033;
    font: inherit;
    min-height: 40px;
    padding: 8px 10px;
}

textarea {
    resize: vertical;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.language-table {
    min-width: 560px;
}

.language-table th,
.language-table td {
    white-space: nowrap;
}

.language-table td:nth-child(2) {
    min-width: 170px;
}

.language-table input[type="checkbox"] {
    min-height: auto;
    width: auto;
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #667085;
    font-weight: 600;
}

.compact-file {
    max-width: 180px;
    font-size: 13px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.login-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    padding: 28px;
    width: min(420px, calc(100vw - 32px));
}

.text-link {
    color: #175cd3;
    text-align: center;
    text-decoration: none;
}

.primary-link {
    background: #2563eb;
    border-radius: 6px;
    color: white;
    padding: 10px 14px;
    text-align: center;
    text-decoration: none;
}

.registration-page {
    min-height: 100vh;
    padding: 32px 18px;
}

.registration-shell {
    margin: 0 auto;
    max-width: 920px;
}

.registration-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.registration-form {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 24px;
}

.registration-form h2 {
    border-bottom: 1px solid #e5e7eb;
    font-size: 18px;
    margin: 12px 0 0;
    padding-bottom: 10px;
}

.registration-form .registration-ads-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.registration-ads-consent input[type="checkbox"] {
    min-width: 16px;
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
}

@media (max-width: 700px) {
    .registration-form { grid-template-columns: 1fr; }
    .registration-form .span-2 { grid-column: span 1; }
    .registration-header { align-items: flex-start; flex-direction: column; gap: 10px; }
}

.error {
    background: #fee2e2;
    border-radius: 6px;
    color: #991b1b;
    padding: 10px;
}

.success {
    background: #dcfce7;
    border-radius: 6px;
    color: #166534;
    margin-top: 14px;
    padding: 10px;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-weight: 700;
    min-width: 72px;
    padding: 6px 10px;
    text-align: center;
}

.status-Available {
    background: #dcfce7;
    color: #166534;
}

.status-Reserved {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-Occupied {
    background: #ffedd5;
    color: #c2410c;
}

.status-NeedService {
    background: #fee2e2;
    color: #b91c1c;
}

.status-Cleaning {
    background: #ede9fe;
    color: #6d28d9;
}

.status-Disabled {
    background: #e5e7eb;
    color: #374151;
}

.table-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.table-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 8px solid #94a3b8;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: space-between;
    min-height: 160px;
    padding: 16px;
}

.table-card h2 {
    font-size: 34px;
    margin: 4px 0;
}

.table-card span {
    color: #667085;
}

.table-card a {
    background: #2563eb;
    border-radius: 6px;
    color: white;
    display: inline-block;
    padding: 10px 14px;
    text-align: center;
    text-decoration: none;
}

.mini-form {
    display: grid;
    gap: 8px;
}

.mini-form label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: #4b5563;
}

.mini-form input,
.mini-form select {
    width: 100%;
}

.status-border-Available {
    border-left-color: #22c55e;
}

.status-border-Occupied {
    border-left-color: #f97316;
}

.status-border-Cleaning {
    border-left-color: #8b5cf6;
}

.status-border-Reserved {
    border-left-color: #3b82f6;
}

.status-border-NeedService {
    border-left-color: #ef4444;
}

.muted {
    color: #667085;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.qr-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
}

.qr-card h2 {
    font-size: 28px;
    margin-bottom: 4px;
}

.qr-image svg {
    height: auto;
    max-width: 180px;
    width: 100%;
}

.qr-url {
    color: #667085;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.qr-placeholder {
    align-items: center;
    background: #f3f4f6;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #667085;
    display: flex;
    height: 180px;
    justify-content: center;
    margin-bottom: 12px;
}

@media print {
    .sidebar,
    .no-print,
    .page-header button {
        display: none !important;
    }

    .shell {
        display: block;
    }

    .content {
        padding: 0;
    }

    body {
        background: white;
    }

    .qr-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .qr-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

@media (max-width: 800px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .form-grid.wide,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }
}
