/* ===== EMSTONE_DJ - Main Stylesheet ===== */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border: #30363d;
    --border-light: #484f58;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --success: #238636;
    --success-hover: #2ea043;
    --danger: #f85149;
    --danger-hover: #ff7b72;
    --warning: #d29922;
    --purple: #8957e5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== Auth Pages (Login, Register, Find Account) ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.auth-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.auth-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
}

.input-group button {
    height: 44px;
    padding: 0 16px;
    white-space: nowrap;
}

.help-text {
    font-size: 12px;
    margin-top: 4px;
}

.help-text.success { color: var(--success); }
.help-text.error { color: var(--danger); }

.remember {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.btn-primary {
    background: var(--success);
    color: white;
}

.btn-primary:hover {
    background: var(--success-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: transparent;
    color: var(--success);
    border: 1px solid var(--success);
}

.btn-success:hover {
    background: var(--success);
    color: white;
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Auth Links */
.auth-links {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-links .divider {
    margin: 0 12px;
    color: var(--border-light);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -13px;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.result-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
}

.result-box strong {
    display: block;
    font-size: 18px;
    color: var(--accent);
    margin-top: 8px;
}

/* ===== Main Layout ===== */
.main-layout {
    display: flex;
    min-height: 100vh;
}

/* Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.header-brand {
    font-size: 22px;
    font-weight: 900;
    background: linear-gradient(135deg, #58a6ff 0%, #79b8ff 50%, #a5d6ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
    text-shadow: 0 0 20px rgba(88, 166, 255, 0.5), 0 0 40px rgba(88, 166, 255, 0.3), 0 0 60px rgba(88, 166, 255, 0.2);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 10px rgba(88, 166, 255, 0.6));
    }
    50% {
        filter: brightness(1.2) drop-shadow(0 0 20px rgba(88, 166, 255, 0.8));
    }
}

.header-brand::before {
    content: '◆';
    margin-right: 8px;
    font-size: 16px;
    background: linear-gradient(135deg, #58a6ff, #79b8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-name strong {
    color: var(--text-primary);
}

.logout-btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* Door Status Badge (Global) */
.door-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    animation: doorPulse 2s infinite;
    white-space: nowrap;
}

.door-status-badge.open {
    background: rgba(248, 81, 73, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.door-status-badge.closed {
    background: rgba(46, 160, 67, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.door-status-badge.unknown {
    background: rgba(187, 128, 9, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

@keyframes doorPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 240px;
    height: calc(100vh - 60px);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 99;
}

.nav-menu {
    padding: 16px 12px;
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    margin-top: 60px;
    padding: 24px;
    min-height: calc(100vh - 60px);
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Chart Container */
.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 16px 8px;
    margin-bottom: 16px;
}

.chart-container canvas {
    width: 100% !important;
    height: 460px !important;
    display: block;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Chart Header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Compact card styles for dashboard */
.dashboard .card {
    padding: 16px;
    margin-bottom: 16px;
}

.dashboard .card-header {
    padding: 12px 0;
    margin-bottom: 12px;
}

.dashboard .data-list {
    overflow-y: auto;
}

.dashboard .data-item {
    padding: 10px 0;
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

/* Data List */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.data-item:hover {
    border-color: var(--border-light);
}

.data-item.my-item {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}

.data-item.out-of-stock {
    opacity: 0.5;
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.data-item.out-of-stock h3 {
    color: var(--text-secondary);
}

/* Card Item Layout (Desktop) */
.card-item {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.card-row-1 {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.card-shop {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.card-memo {
    color: var(--text-secondary);
    font-size: 13px;
}

.card-row-2 {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-amount {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.card-total {
    background: rgba(88,166,255,0.1) !important;
}

.card-grand-total {
    background: rgba(88,166,255,0.15) !important;
    border-color: var(--accent) !important;
}

.data-item.out-of-stock p {
    color: var(--text-muted);
}

/* ===== New Card Box UI ===== */
.card-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.card-box:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card-box.my-card {
    border-color: rgba(88, 166, 255, 0.4);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(88, 166, 255, 0.05) 100%);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-category {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.card-image-icon {
    font-size: 16px;
    background: rgba(88, 166, 255, 0.15);
    padding: 4px 8px;
    border-radius: 6px;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-main-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-shop-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.card-memo-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.card-date-text {
    font-size: 13px;
    color: var(--text-muted);
}

.card-amount-text {
    font-weight: 700;
    font-size: 15px;
    color: var(--accent);
}

.card-delete-overlay {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(248, 81, 73, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.card-box:hover .card-delete-overlay {
    opacity: 1;
}

.card-delete-overlay:hover {
    background: rgba(248, 81, 73, 0.2);
}

.delete-icon {
    font-size: 14px;
}

/* Detail Modal Styles */
.detail-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.detail-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-value.highlight {
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
}

.image-gallery {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.image-gallery h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.image-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.image-item:hover {
    border-color: var(--accent);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.data-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.data-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.data-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.icon-btn.delete:hover {
    background: var(--danger);
    color: white;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn {
    flex: 1;
}

/* Form Elements in Modal */
.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Date input calendar picker icon */
.form-row input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
    cursor: pointer;
}

.form-row input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.form-row textarea {
    resize: vertical;
    min-height: 80px;
}

/* Reason Chips */
.reason-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.reason-option {
    position: relative;
}

.reason-option input {
    position: absolute;
    opacity: 0;
}

.reason-option label {
    display: block;
    padding: 12px;
    text-align: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.reason-option input:checked + label {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

/* View Toggle (Cards Page) */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.view-toggle .toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.view-toggle .toggle-btn.active {
    background: var(--accent);
    color: white;
}

/* Date Control (Cards Page) */
.date-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.date-control span {
    font-weight: 600;
    font-size: 16px;
    min-width: 140px;
    text-align: center;
}

.file-upload:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.05);
}

.file-upload input {
    display: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 14px 28px;
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: var(--success);
    background: rgba(35, 134, 54, 0.1);
}

.toast.error {
    border-color: var(--danger);
    background: rgba(248, 81, 73, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Section Group */
.section-group {
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Project Groups (for companies) */
.project-group {
    margin-bottom: 24px;
}

.project-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    padding: 12px 16px;
    background: rgba(88, 166, 255, 0.1);
    border-radius: 10px 10px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
}

.project-items {
    border: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.project-items .data-item {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
}

.project-items .data-item:last-child {
    border-bottom: none;
}

/* Today Button */
.btn-today {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-today:hover {
    background: #4da6ff;
    border-color: #4da6ff;
}

/* Schedule Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding: 16px 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 20px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.timeline-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.timeline-date strong {
    color: var(--accent);
    font-weight: 700;
}

.timeline-content {
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.timeline-content:hover {
    background: var(--bg-tertiary);
}

.timeline-content h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.timeline-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-today .timeline-date {
    color: var(--success);
    font-size: 14px;
    font-weight: 700;
}

.timeline-today .timeline-date::before {
    content: '▶ ';
    color: var(--success);
}

.timeline-today::before {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(46, 160, 67, 0.4), 0 0 15px rgba(46, 160, 67, 0.6);
    animation: pulse-today 2s ease-in-out infinite;
}

@keyframes pulse-today {
    0%, 100% { box-shadow: 0 0 0 4px rgba(46, 160, 67, 0.4), 0 0 15px rgba(46, 160, 67, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(46, 160, 67, 0.3), 0 0 20px rgba(46, 160, 67, 0.8); }
}

.timeline-today .timeline-content {
    border-left: 3px solid var(--success);
}

/* Responsive */
@media (max-width: 768px) {
    /* Reset layout for mobile */
    .main-layout {
        display: block;
    }
    
    /* Fixed header on mobile */
    .top-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        min-height: 70px;
        padding: 8px 12px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        z-index: 1000;
    }
    
    .header-brand {
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .header-user {
        width: auto;
        justify-content: flex-end;
        gap: 8px;
        flex: 1;
    }
    
    .user-name {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .logout-btn {
        padding: 4px 10px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Horizontal nav below header */
    .sidebar {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 50px;
        z-index: 999;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: var(--bg-secondary);
    }
    
    .nav-menu {
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding: 6px 12px;
        margin: 0;
    }
    
    .nav-item {
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .nav-link {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .nav-icon {
        font-size: 16px;
    }
    
    /* Main content starts below header + nav */
    .main-content {
        margin-left: 0;
        margin-top: 140px; /* header(70) + nav(50) + padding(20) */
        padding: 12px;
    }
    
    /* Page header */
    .page-header h1 {
        font-size: 20px;
    }
    
    /* Cards full width */
    .card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    /* Controls stack */
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    /* Data items stack */
    .data-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .data-info {
        width: 100%;
    }
    
    .data-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* Chart smaller */
    .chart-container {
        padding: 12px 12px 4px;
    }

    .chart-container canvas {
        height: 260px !important;
    }
    
    /* Project header */
    .project-header {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    /* Modal full screen on mobile */
    .modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .modal-overlay {
        padding: 0;
    }
    
    /* Timeline padding */
    .timeline {
        padding-left: 20px;
    }
    
    .timeline::before {
        left: 6px;
    }
    
    .timeline-item::before {
        left: -18px;
    }
    
    /* Auth pages mobile optimization */
    .auth-container {
        padding: 16px;
    }
    
    .auth-box {
        padding: 24px 20px;
    }
    
    .auth-logo {
        font-size: 24px;
    }
    
    /* Form inputs mobile */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }
    
    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    /* Dashboard grid mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    /* Card header mobile */
    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    /* View toggle mobile */
    .view-toggle {
        width: 100%;
    }
    
    .view-toggle .toggle-btn {
        flex: 1;
        text-align: center;
        padding: 10px;
    }
    
    /* Date control mobile */
    .date-control {
        width: 100%;
        justify-content: center;
        gap: 24px;
    }
    
    .date-control .btn {
        min-width: 70px;
    }
    
    /* Card items mobile - thinner */
    .data-list .data-item {
        padding: 10px 12px;
        min-height: auto;
    }
    
    .data-list .data-item h3 {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .data-list .data-item p {
        font-size: 12px;
    }
    
    /* Card item mobile layout */
    .card-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }
    
    .card-row-1 {
        display: flex;
        gap: 8px;
        width: 100%;
        font-size: 14px;
    }
    
    .card-shop {
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .card-memo {
        color: var(--text-secondary);
        font-size: 12px;
    }
    
    .card-row-2 {
        width: 100%;
        font-size: 12px;
        color: var(--text-muted);
    }
    
    .card-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
    
    .card-amount {
        font-weight: 600;
        font-size: 14px;
        color: var(--text-primary);
    }
    
    /* Card box mobile styles */
    .card-box {
        padding: 12px 14px;
    }
    
    .card-box:hover .card-delete-overlay {
        opacity: 0;
    }
    
    .card-box .card-delete-overlay {
        display: none;
    }
    
    .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
        width: 100%;
    }
    
    .card-category {
        font-size: 11px;
        padding: 2px 8px;
        flex-shrink: 0;
        order: 1;
        text-align: left;
        margin-right: auto;
    }
    
    .card-image-icon {
        font-size: 14px;
        padding: 3px 6px;
        order: 2;
        margin-left: auto;
    }
    
    .card-shop-name {
        font-size: 14px;
    }
    
    .card-memo-text {
        font-size: 12px;
    }
    
    .card-amount-text {
        font-size: 14px;
    }
    
    .card-meta-row {
        margin-top: 2px;
    }
    
    /* Image grid mobile */
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    /* Card total/grand total - single column like PC */
    .card-total,
    .card-grand-total {
        flex-direction: row !important;
    }
    
    .card-total {
        background: rgba(88,166,255,0.1) !important;
    }
    
    .card-grand-total {
        background: rgba(88,166,255,0.15) !important;
        border-color: var(--accent) !important;
    }
    
    /* Pill badge styling */
    .card-actions .pill {
        font-size: 11px;
        padding: 3px 10px;
    }
    
    /* User tabs scrollable */
    .user-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Project items mobile */
    .project-items {
        padding: 8px;
    }
    
    .project-items .data-item {
        padding: 12px;
    }
    
    /* Project info mobile */
    .project-header div div:last-child {
        font-size: 11px;
    }
    
    /* Section group mobile */
    .section-group {
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 13px;
    }
    
    /* KV grid mobile */
    .kv-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .kv-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Snap container mobile */
    .snap-container {
        max-height: 250px;
    }
    
    /* Reason grid mobile */
    .reason-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* File upload mobile */
    .file-upload {
        padding: 20px;
    }
    
    /* Modal header mobile */
    .modal-header {
        padding: 16px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    /* Modal body mobile */
    .modal-body {
        padding: 16px;
    }
    
    /* Modal footer mobile */
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Pill badge mobile */
    .pill {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    /* Toast mobile */
    .toast {
        max-width: 90%;
        font-size: 14px;
        padding: 12px 20px;
    }
    
    /* Empty state mobile */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-state svg {
        width: 48px;
        height: 48px;
    }
    
    /* Auth pages */
    .auth-box {
        padding: 20px;
        border-radius: 0;
        border: none;
    }
    
    .auth-container {
        padding: 0;
        max-width: 100%;
    }
    
    /* Reason grid 2 columns */
    .reason-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Stats and grids */
    .dashboard-grid,
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    /* Toggle buttons wrap */
    .view-toggle {
        flex-wrap: wrap;
    }
    
    .toggle-btn {
        flex: 1;
        min-width: 80px;
    }
    
    /* Company item model name */
    .data-info[style*="display: flex"] {
        flex-direction: column;
        gap: 4px;
    }
    
    .data-info[style*="display: flex"] h3 {
        min-width: auto !important;
    }
}

/* Hide scrollbar but keep functionality */
.nav-menu::-webkit-scrollbar {
    height: 0;
}

/* Company item styles */
.company-item-info {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
}

.company-model {
    min-width: 180px;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
}

.company-quantity {
    color: var(--text-secondary);
    font-size: 13px;
}

.company-amount {
    font-weight: 600;
    margin-right: 12px;
}

/* Mobile: Company item adjustments */
@media (max-width: 768px) {
    .company-item {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
    }
    
    .company-item-info {
        flex-direction: row;
        gap: 6px;
        flex: 1;
        align-items: center;
        min-width: 0;
    }
    
    .company-model {
        min-width: 0;
        font-size: 12px;
        text-align: left;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .company-quantity {
        font-size: 11px;
        flex-shrink: 0;
    }
    
    .company-amount {
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .company-item .data-actions {
        width: auto;
        justify-content: flex-end;
        flex-shrink: 0;
        gap: 4px;
    }
    
    /* Dashboard chart mobile fix */
    .chart-container {
        padding: 12px 12px 4px;
    }
    
    /* Mobile header adjustments */
    .top-header {
        padding: 0 12px;
        height: 56px;
    }
    
    .header-brand {
        font-size: 16px;
        letter-spacing: 1px;
    }
    
    .header-brand::before {
        font-size: 12px;
        margin-right: 4px;
    }
    
    .header-user {
        gap: 8px;
    }
    
    /* Compact door status badge for mobile */
    .door-status-badge {
        padding: 2px 6px;
        font-size: 10px;
        font-weight: 600;
        border-radius: 8px;
        margin-right: 4px;
        white-space: nowrap;
        max-width: 50px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Hide OPEN/CLOSE text, show only icon on very small screens */
    @media (max-width: 480px) {
        .door-status-badge.open::after,
        .door-status-badge.closed::after,
        .door-status-badge.unknown::after {
            content: '';
        }
        
        .door-status-badge {
            font-size: 0;
            padding: 4px;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .door-status-badge.open::before {
            content: '🔓';
            font-size: 14px;
        }
        
        .door-status-badge.closed::before {
            content: '🔒';
            font-size: 14px;
        }
        
        .door-status-badge.unknown::before {
            content: '❓';
            font-size: 14px;
        }
        
        /* Hide user greeting only on very small screens */
        .user-name {
            display: none;
        }
    }
    
    /* Smaller logout button on mobile */
    .logout-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Notification Settings Styles */
.notification-grid {
    display: grid;
    gap: 12px;
}

.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.notification-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-icon {
    font-size: 24px;
}

.notification-text h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-text p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-switch.active {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch.active::after {
    left: 24px;
}
