*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    background: #f4f5f7;
    color: #1a1a2e;
    overscroll-behavior: none;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
}

/* Top bar */
#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    flex-shrink: 0;
}

#tb-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
}

#tb-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 1px;
}

#btn-profile {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e1f5ee;
    color: #0f6e56;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
}

/* Screens */
.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

.screen.active {
    display: block;
}

/* Clock card */
#clock-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.clock-info {
    flex: 1;
}

.clock-state {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-in {
    background: #1d9e75;
    animation: pulse 1.5s ease-in-out infinite;
}

.dot-out {
    background: #e24b4a;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .35
    }
}

.clock-time {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
}

.clock-geo {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}

.clock-geo i {
    font-size: 13px;
    color: #1d9e75;
}

.clock-geo.error i {
    color: #e24b4a;
}

/* Summary grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sum-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.sum-card:active {
    background: #f4f5f7;
}

.sum-icon {
    font-size: 22px;
    color: #6b7280;
    margin-bottom: 6px;
}

.sum-num {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1;
}

.sum-label {
    font-size: 11px;
    color: #6b7280;
    margin-top: 3px;
}

.sum-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 6px;
}

.bg-red {
    background: #feecec;
    color: #a32d2d;
}

.bg-green {
    background: #e1f5ee;
    color: #0f6e56;
}

.bg-amber {
    background: #faeeda;
    color: #7a4a00;
}

.bg-gray {
    background: #f4f5f7;
    color: #6b7280;
    border: 1px solid #e8eaed;
}

/* Back / title */
.back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    margin-bottom: 12px;
    padding: 4px 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.back-btn i {
    font-size: 17px;
}

.screen-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 14px;
}

/* Tab strip */
.tab-strip {
    display: flex;
    border-bottom: 1px solid #e8eaed;
    margin-bottom: 14px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-strip::-webkit-scrollbar {
    display: none;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 9px 4px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tab.active {
    color: #0f6e56;
    border-bottom-color: #0f6e56;
}

/* List cards */
.list-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.lc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.lc-prop {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
}

.lc-time {
    font-size: 12px;
    color: #6b7280;
}

.lc-guest {
    font-size: 12px;
    color: #6b7280;
}

.lc-contacts {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.lc-contacts a {
    font-size: 12px;
    color: #0f6e56;
    text-decoration: none;
}

.pill {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 6px;
}

.pill-overdue {
    background: #feecec;
    color: #a32d2d;
}

.pill-out {
    background: #faeeda;
    color: #7a4a00;
}

.pill-in {
    background: #e1f5ee;
    color: #0f6e56;
}

.pill-upcoming {
    background: #f4f5f7;
    color: #6b7280;
    border: 1px solid #e8eaed;
}

/* Review cards */
.rev-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.rc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 4px;
}

.rc-prop {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
    padding-right: 8px;
}

.rc-score {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    flex-shrink: 0;
}

.score-bad {
    background: #feecec;
    color: #a32d2d;
}

.score-ok {
    background: #faeeda;
    color: #7a4a00;
}

.score-good {
    background: #e1f5ee;
    color: #0f6e56;
}

.rc-guest {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 6px;
}

.rc-body {
    font-size: 12px;
    color: #374151;
    line-height: 1.55;
    margin-bottom: 8px;
    font-style: italic;
}

.rc-ota {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rc-ota i {
    font-size: 14px;
}

/* Action form */
.action-form {
    background: #f9fafb;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    padding: 12px;
    margin-top: 10px;
}

.af-title {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.af-title i {
    font-size: 14px;
    color: #e24b4a;
}

.form-lbl {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 3px;
}

.form-ctrl {
    width: 100%;
    font-size: 12px;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #1a1a2e;
    margin-bottom: 8px;
    outline: none;
}

.form-ctrl:focus {
    border-color: #0f6e56;
}

textarea.form-ctrl {
    resize: none;
    height: 60px;
    line-height: 1.45;
}

.yn-grid {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.yn-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #e8eaed;
}

.yn-row:last-child {
    border-bottom: none;
}

.yn-q {
    font-size: 11px;
    color: #374151;
    flex: 1;
    padding-right: 8px;
    line-height: 1.4;
}

.yn-btns {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.yn-btn {
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    color: #6b7280;
    -webkit-tap-highlight-color: transparent;
}

.yn-btn.yes {
    background: #e1f5ee;
    color: #0f6e56;
    border-color: #5dcaa5;
}

.yn-btn.no {
    background: #feecec;
    color: #a32d2d;
    border-color: #f09595;
}

.af-footer {
    display: flex;
    justify-content: flex-end;
}

/* Task cards */
.task-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.task-card:active {
    background: #f9fafb;
}

.tc-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 5px;
}

.tc-type {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    background: #f4f5f7;
    color: #6b7280;
    border: 1px solid #e8eaed;
    flex-shrink: 0;
    margin-top: 2px;
}

.tc-prop {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
}

.tc-q {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 3px;
}

.tc-ans {
    font-size: 12px;
    color: #1a1a2e;
    font-weight: 500;
    margin-bottom: 6px;
}

.tc-meta {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pri-high {
    color: #a32d2d;
    font-weight: 600;
}

.pri-med {
    color: #ba7517;
    font-weight: 600;
}

/* Task modal */
#task-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1000;
    align-items: flex-end;
}

#task-modal-overlay.active {
    display: flex;
}

#task-modal-sheet {
    background: #fff;
    border-radius: 18px 18px 0 0;
    padding: 16px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 14px;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 3px;
}

.modal-sub {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 14px;
}

.modal-sec {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 7px;
    margin-top: 12px;
}

.detail-block {
    background: #f9fafb;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #e8eaed;
    font-size: 12px;
}

.detail-row:last-child {
    border-bottom: none;
}

.dr-key {
    color: #6b7280;
}

.dr-val {
    color: #1a1a2e;
    font-weight: 600;
    text-align: right;
    max-width: 220px;
    word-break: break-word;
}

.comment-bubble {
    background: #f4f5f7;
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 7px;
}

.cb-text {
    font-size: 12px;
    color: #1a1a2e;
    line-height: 1.5;
}

.cb-meta {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
}

.modal-photo-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.modal-photo-grid img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e8eaed;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn-resolve {
    flex: 1;
    padding: 11px;
    background: #e1f5ee;
    color: #0f6e56;
    border: 1px solid #5dcaa5;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-add-note {
    flex: 1;
    padding: 11px;
    background: #f4f5f7;
    color: #1a1a2e;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Profile */
.profile-block {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #a32d2d;
    border: 1px solid #f09595;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Buttons */
.btn-primary-sm {
    padding: 8px 14px;
    background: #0f6e56;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-clockout {
    background: #a32d2d !important;
}

/* Loading / empty */
.loading-row,
.empty-row {
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    padding: 32px 0;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid #e8eaed;
    border-top-color: #0f6e56;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transition: opacity .25s;
    white-space: nowrap;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
}

.sum-card.locked {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.logout-btn {
    font-size: 20px;
    color: var(--color-text-secondary);
    text-decoration: none;
}

.logout-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px 8px;
}

.logout-btn:hover {
    color: var(--color-text-primary);
}