* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f4f6f8;
    color: #222;
}

.pwa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.connection-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, .22);
}

.connection-status.is-offline::before {
    background: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, .22);
}

.pwa-install-button {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, .65);
    background: #fff;
    color: #7a1f1f;
    font-size: 12px;
}

.pwa-install-button:hover {
    background: #fef2f2;
}

.login-card {
    max-width: 480px;
    margin: min(12vh, 100px) auto 0;
}

.login-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    color: #555;
}

.login-status-row .pwa-install-button {
    background: #7a1f1f;
    color: #fff;
}

.offline-page {
    width: min(92%, 520px);
    margin: 12vh auto;
    padding: 32px;
    text-align: center;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, .12);
}

.offline-page img {
    border-radius: 22px;
}

@media (max-width: 768px) {
    .pwa-actions {
        gap: 5px;
    }

    .pwa-install-button {
        padding: 5px 7px;
    }

    .app {
        padding: 12px;
    }

    .card {
        padding: 14px;
    }

    .login-card {
        margin-top: 5vh;
    }
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.topbar {
    background: #7a1f1f;
    color: white;
    padding: 0;
    margin-bottom: 8px;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    list-style: none;
    padding: 0;
}

.menu-grid li a {
    display: block;
    background: #ffffff;
    color: #7a1f1f;
    padding: 18px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.menu-grid li a:hover {
    background: #7a1f1f;
    color: white;
}

a {
    color: #7a1f1f;
    font-weight: bold;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin-top: 15px;
}

th {
    background: #7a1f1f;
    color: white;
}

th, td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

tr:nth-child(even) {
    background: #f9f9f9;
}

input, select, textarea {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    margin-top: 4px;
    border: 1px solid #bbb;
    border-radius: 6px;
}

button {
    background: #7a1f1f;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background: #5c1717;
}

.nav-links {
    margin-bottom: 15px;
}

.nav-links a {
    margin-right: 10px;
}

.success {
    color: green;
    font-weight: bold;
}

.error {
    color: red;
    font-weight: bold;
}

@media print {
    .no-print,
    .topbar,
    .nav-links,
    button {
        display: none;
    }

    body {
        background: white;
    }

    .app {
        max-width: none;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: none;
    }
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.summary-card {
    background: #ffffff;
    border: 1px solid #ddd;
    border-left: 6px solid #7b1e1e;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.summary-card h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #555;
}

.summary-card .summary-value {
    font-size: 26px;
    font-weight: bold;
    color: #222;
}

.summary-card.money {
    border-left-color: #1f6f3f;
}

.summary-card.warning {
    border-left-color: #c27c00;
}

.summary-card.danger {
    border-left-color: #b00020;
}

.summary-card.good {
    border-left-color: #1f6f3f;
}

.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: bold;
    font-size: 13px;
}

.status-available {
    background: #e6f4ea;
    color: #137333;
}

.status-occupied {
    background: #fce8e6;
    color: #b3261e;
}

.status-cleaning {
    background: #fff7e0;
    color: #9a6700;
}

.status-maintenance {
    background: #eeeeee;
    color: #444;
}

.status-reserved {
    background: #e8f0fe;
    color: #174ea6;
}

.room-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.room-summary-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.room-summary-card h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
}

.room-summary-card .count {
    font-size: 28px;
    font-weight: bold;
}

.action-links a {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 5px;
}

.btn-link {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    margin: 2px;
    background: #7a1f1f;
    color: white;
}

.btn-link:hover {
    background: #5c1717;
    color: white;
}

.btn-secondary {
    background: #555;
}

.btn-secondary:hover {
    background: #333;
}

.btn-success {
    background: #1f6f3f;
}

.btn-success:hover {
    background: #15552f;
}

.btn-warning {
    background: #c27c00;
}

.btn-warning:hover {
    background: #9a6300;
}

.btn-danger {
    background: #b00020;
}

.btn-danger:hover {
    background: #850018;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 15px;
}

.inline-status-form {
    display: inline-block;
    margin: 2px;
}

.inline-status-form button {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}

.pos-header {
    background: #7f1d1d;
    color: white;
    display: flex;
    align-items: center;
    padding: 4px 14px;
    gap: 12px;
    min-height: 48px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.20);
}

.header-logo-box {
    background: white;
    padding: 3px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 122px;
    height: 40px;
    overflow: hidden;
    flex-shrink: 0;
}

.hotel-logo,
.topbar img {
    width: 110px !important;
    max-width: 110px !important;
    height: auto !important;
    max-height: 34px !important;
    object-fit: contain;
    display: block;
}

.header-title {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.3px;
    line-height: 1.0;
}

/* Mobile adjustment */
@media (max-width: 768px) {
    .pos-header {
        flex-direction: column;
        text-align: center;
        padding: 7px;
        gap: 5px;
    }

    .header-logo-box {
        width: 130px;
        height: 44px;
    }

    .hotel-logo,
    .topbar img {
        width: 115px !important;
        max-width: 115px !important;
        max-height: 36px !important;
    }

    .header-title {
        font-size: 18px;
    }
}

/* Compact POS header and favicon update - 2026-05-08 */
.topbar {
    margin-bottom: 6px !important;
}

.pos-header {
    background: #7f1d1d !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 2px 12px !important;
    min-height: 38px !important;
    height: 38px !important;
    line-height: 1 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18) !important;
    overflow: visible !important;
}

.header-logo-box {
    background: white !important;
    width: auto !important;
    height: 34px !important;
    padding: 1px 5px !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
}

.hotel-logo,
.topbar img {
    width: auto !important;
    height: 32px !important;
    max-width: 92px !important;
    max-height: 32px !important;
    object-fit: contain !important;
    display: block !important;
}

.header-title {
    font-size: 18px !important;
    font-weight: bold !important;
    letter-spacing: 0.2px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

@media (max-width: 768px) {
    .pos-header {
        min-height: 36px !important;
        height: auto !important;
        padding: 3px 8px !important;
        gap: 6px !important;
        flex-direction: row !important;
        text-align: left !important;
    }

    .header-logo-box {
        height: 32px !important;
        padding: 1px 4px !important;
    }

    .hotel-logo,
    .topbar img {
        height: 30px !important;
        max-height: 30px !important;
        max-width: 86px !important;
    }

    .header-title {
        font-size: 15px !important;
        white-space: normal !important;
    }
}

/* Staff Time Clock + Salary Management - 2026-07-04 */
.staff-clock-card {
    border-left: 6px solid #7a1f1f;
}

.staff-clock-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 340px);
    gap: 18px;
    align-items: start;
}

.staff-clock-form label {
    font-weight: 700;
}

.staff-clock-form input[name="staff_time_code"] {
    font-size: 28px;
    letter-spacing: 8px;
    text-align: center;
    max-width: 180px;
}

.staff-clock-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.staff-clock-buttons button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.staff-camera-box {
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 340px;
    aspect-ratio: 3 / 4;
    min-height: 0;
    margin-left: auto;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}

.staff-camera-box video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
}

.staff-camera-status {
    font-size: 13px;
    color: #555;
    margin-top: 10px;
}

.salary-summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.small-muted {
    color: #666;
    font-size: 13px;
}

.photo-thumb {
    width: 74px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #eee;
}

@media (max-width: 768px) {
    .staff-clock-grid {
        grid-template-columns: 1fr;
    }

    .staff-camera-box {
        margin-left: 0;
        max-width: 260px;
    }
}
