* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* ========== Navbar ========== */
.navbar {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

/* ========== Container ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 24px;
    color: #1a73e8;
    margin-bottom: 6px;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

/* ========== Cards ========== */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== Dashboard ========== */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== Tables ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background: #f8f9ff;
}

.table tbody tr.status-in {
    border-left: 3px solid #34a853;
}

.table tbody tr.status-out {
    border-left: 3px solid #ea4335;
}

.table tbody tr.status-temp {
    border-left: 3px solid #f9ab00;
}

/* ========== Status Tags ========== */
.status-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-tag.status-in {
    background: #e6f4ea;
    color: #1e7e34;
}

.status-tag.status-out {
    background: #fce8e6;
    color: #c5221f;
}

.status-tag.status-temp {
    background: #fef7e0;
    color: #e37400;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.badge-in {
    background: #e6f4ea;
    color: #1e7e34;
}

.badge-temp {
    background: #fef7e0;
    color: #e37400;
}

/* ========== Buttons ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #1a73e8;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #1557b0;
}

.btn-secondary {
    background: #e8eaed;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #d2d5d9;
}

.btn-danger {
    background: #ea4335;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #c5221f;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    margin: 1px;
}

.btn-in {
    background: #34a853;
    color: #fff;
}

.btn-in:hover {
    background: #2d9249;
}

.btn-out {
    background: #ea4335;
    color: #fff;
}

.btn-out:hover {
    background: #c5221f;
}

.btn-temp {
    background: #f9ab00;
    color: #fff;
}

.btn-temp:hover {
    background: #e09500;
}

/* ========== Action Buttons ========== */
.action-btns {
    white-space: nowrap;
}

/* ========== Announcement Bar ========== */
.announcement-bar {
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
}

.announcement-bar.scrolling {
    position: relative;
    overflow: hidden;
}

.scroll-text {
    display: inline-block;
    white-space: nowrap;
    animation: scroll-left 20s linear infinite;
}

@keyframes scroll-left {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-content {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.loading-content h1 {
    font-size: 28px;
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hitokoto-box {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hitokoto-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.hitokoto-from {
    font-size: 13px;
    opacity: 0.8;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    opacity: 0.8;
}

/* ========== Scanner Page ========== */
.scanner-page {
    max-width: 500px;
    margin: 0 auto;
}

.camera-select {
    margin-bottom: 16px;
}

.camera-select label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #333;
    appearance: auto;
}

.scanner-box {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.scanner-box #reader {
    width: 100%;
}

.scanner-box video {
    width: 100%;
    border-radius: 12px;
}

.scanner-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

/* ========== Result Area ========== */
.result-area {
    display: none;
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
}

.result-message {
    font-size: 15px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 8px;
}

.result-message.success {
    background: #e6f4ea;
    color: #1e7e34;
    border: 1px solid #a8dab5;
}

.result-message.error {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c6c2;
}

/* ========== Warning Overlay ========== */
.warning-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.warning-dialog {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.warning-dialog h3 {
    font-size: 22px;
    margin-bottom: 16px;
    color: #ea4335;
}

.warning-dialog p {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.6;
}

.warning-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

/* ========== Info Banner ========== */
.info-banner {
    background: #e8f0fe;
    border: 1px solid #a8c7fa;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.info-banner p {
    color: #1a56b0;
    font-size: 14px;
    line-height: 1.6;
}

/* ========== Tempout Duration ========== */
.tempout-duration {
    max-width: 500px;
    margin: 0 auto 20px;
}

.tempout-duration label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 300;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* ========== Empty State ========== */
.empty-text {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: #1a73e8;
        flex-direction: column;
        padding: 8px 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-link {
        padding: 12px 20px;
        border-radius: 0;
        font-size: 15px;
    }

    .nav-toggle {
        display: block;
    }

    .container {
        padding: 12px;
    }

    .card {
        padding: 14px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }

    .loading-content h1 {
        font-size: 22px;
    }

    .hitokoto-text {
        font-size: 16px;
    }

    .scanner-box #reader {
        width: 100%;
    }
}