:root {
  --red: #CC1517;
  --red-dark: #8B0000;
  --red-light: #E8353A;
  --white: #fff;
  --bg: #f2f2f2;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --muted: #757575;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --danger: #c62828;
  --danger-bg: #ffebee;
  --warning: #e65100;
  --warning-bg: #fff3e0;
  --pending: #1565c0;
  --pending-bg: #e3f2fd;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

.view { display: none; }
.view.active { display: block; }

/* LOGIN */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(150deg, var(--red-dark) 0%, var(--red) 100%); padding: 24px; }
.login-logo { width: 200px; margin-bottom: 32px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3)); }
.login-card { background: white; border-radius: 20px; padding: 32px 24px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.login-title { text-align: center; font-size: 1.25rem; font-weight: 700; color: var(--red-dark); margin-bottom: 24px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.05em; }
.form-input { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; font-size: 1rem; transition: border-color 0.2s; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--red); }
.form-textarea { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; font-size: 0.95rem; resize: vertical; min-height: 90px; font-family: inherit; }
.form-textarea:focus { outline: none; border-color: var(--red); }
.form-select { width: 100%; padding: 11px 16px; border: 2px solid var(--border); border-radius: 10px; font-size: 0.95rem; background: white; cursor: pointer; font-family: inherit; }
.form-select:focus { outline: none; border-color: var(--red); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--red); color: white; width: 100%; }
.btn-primary:hover { background: var(--red-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1b5e20; }
.btn-ghost { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn-ghost:hover { background: var(--red); color: white; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 8px; width: auto; }
.btn-icon { padding: 8px; border-radius: 8px; width: auto; }

/* HEADER (store) */
.header { background: var(--red); color: white; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.header-logo { height: 30px; filter: brightness(0) invert(1); }
.header-title { font-size: 1rem; font-weight: 700; flex: 1; }
.header-store-name { font-size: 0.75rem; opacity: 0.85; }
.back-btn { background: none; border: none; cursor: pointer; color: white; display: flex; align-items: center; padding: 4px; flex-shrink: 0; }

/* PAGE CONTENT */
.page-content { padding: 16px; padding-bottom: 24px; max-width: 700px; margin: 0 auto; }

/* CARDS */
.card { background: white; border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-missing { background: #f0f0f0; color: #9e9e9e; }

/* PROGRESS */
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--red); border-radius: 4px; transition: width 0.5s ease; }

/* CHECKLIST ITEMS (store view) */
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: white; border-radius: 14px; margin-bottom: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
.checklist-item:hover { border-color: var(--red); box-shadow: 0 4px 12px rgba(204,21,23,0.1); }
.checklist-item.done { border-color: #a5d6a7; }
.item-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.item-icon.pending-icon { background: #f5f5f5; }
.item-icon.done-icon { background: var(--success-bg); }
.item-info { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 0.95rem; }
.item-desc { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.item-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }

/* CAMERA VIEW */
.camera-card { background: white; border-radius: 16px; padding: 20px; }
.camera-preview { width: 100%; aspect-ratio: 4/3; background: #111; border-radius: 14px; overflow: hidden; margin: 16px 0; display: flex; align-items: center; justify-content: center; }
.camera-preview img { width: 100%; height: 100%; object-fit: cover; }
.camera-placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #555; }
.camera-btn { width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--red); background: white; display: flex; align-items: center; justify-content: center; cursor: pointer; margin: 0 auto 8px; transition: all 0.2s; box-shadow: 0 4px 16px rgba(204,21,23,0.2); }
.camera-btn:hover { background: var(--red); }
.camera-btn:hover svg { color: white !important; }
.camera-btn:active { transform: scale(0.95); }
.btn-row { display: flex; gap: 12px; justify-content: center; }

/* ADMIN LAYOUT */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: var(--red-dark); color: white; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform 0.3s ease; }
.admin-sidebar.open { transform: translateX(0); }
@media (min-width: 860px) { .admin-sidebar { transform: translateX(0); } .admin-main { margin-left: 240px; } }
.sidebar-logo-area { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo-area img { width: 130px; filter: brightness(0) invert(1); }
.sidebar-logo-area span { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.5); margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.75); cursor: pointer; transition: all 0.2s; border: none; background: none; width: 100%; text-align: left; font-size: 0.9rem; font-family: inherit; }
.sidebar-item:hover { background: rgba(255,255,255,0.12); color: white; }
.sidebar-item.active { background: rgba(255,255,255,0.18); color: white; font-weight: 700; border-left: 3px solid white; }
.sidebar-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 45; display: none; }
.sidebar-overlay.show { display: block; }

.admin-main { flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar { background: white; border-bottom: 1px solid var(--border); padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.topbar-brand { font-weight: 700; color: var(--red); font-size: 1rem; }
.topbar-sub { font-size: 0.8rem; color: var(--muted); }
.admin-content { padding: 20px; flex: 1; max-width: 1000px; }

/* STATS */
.stats-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 600px) { .stats-row { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: white; border-radius: 14px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--red); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 6px; font-weight: 600; }

/* STORES GRID */
.stores-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 500px) { .stores-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 750px) { .stores-grid { grid-template-columns: repeat(5, 1fr); } }
.store-card { background: white; border-radius: 14px; padding: 16px 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); cursor: pointer; transition: all 0.2s; border: 2px solid transparent; }
.store-card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(204,21,23,0.12); }
.store-card-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
.store-card-pct { font-size: 1.5rem; font-weight: 800; color: var(--red); }
.store-card-sub { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* DOT STATUS */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: #43a047; }
.dot-yellow { background: #f59e0b; }
.dot-gray { background: #bdbdbd; }
.dot-red { background: var(--danger); }

/* TABLE */
.table-wrap { overflow-x: auto; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: white; }
thead th { background: var(--red); color: white; padding: 12px 14px; text-align: left; font-size: 0.8rem; font-weight: 700; }
thead th:first-child { border-radius: 14px 0 0 0; }
thead th:last-child { border-radius: 0 14px 0 0; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }

/* MODALS */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: white; border-radius: 20px; width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; display: flex; align-items: center; }
.modal-body { padding: 20px; }
.modal-photo { width: 100%; border-radius: 10px; margin-bottom: 16px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ITEM MANAGER */
.item-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: white; border-radius: 12px; margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.item-row-info { flex: 1; min-width: 0; }
.item-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 20px; background: #f0f0f0; font-size: 0.7rem; color: var(--muted); font-weight: 600; }

/* TOAST */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px); background: #1a1a1a; color: white; padding: 10px 22px; border-radius: 24px; font-size: 0.88rem; opacity: 0; transition: all 0.28s; z-index: 9999; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ALERT */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 0.88rem; font-weight: 500; }
.alert-error { background: var(--danger-bg); color: var(--danger); }

/* DATE ROW */
.date-row { display: flex; align-items: center; gap: 8px; background: white; padding: 9px 14px; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.date-label { font-size: 0.8rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.date-input { flex: 1; border: none; font-size: 0.9rem; color: var(--text); cursor: pointer; font-family: inherit; min-width: 0; }
.date-input:focus { outline: none; }

/* SECTION TITLE */
.section-title { font-size: 0.85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; margin-top: 4px; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state svg { width: 56px; height: 56px; opacity: 0.25; margin-bottom: 12px; }

/* ADMIN OBS BOX */
.obs-box { margin-top: 14px; padding: 12px 14px; background: #f8f8f8; border-radius: 10px; border-left: 3px solid var(--red); text-align: left; }
.obs-box-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.obs-box-text { font-size: 0.85rem; color: #444; font-style: italic; }

/* SPINNER */
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--red); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* MULTI-PHOTO SLOTS */
.photo-slots-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.photo-slot { background: #f8f8f8; border-radius: 12px; overflow: hidden; border: 2px solid transparent; transition: border-color 0.2s; }
.photo-slot.has-photo { border-color: #a5d6a7; }
.photo-slot.has-new   { border-color: var(--red); }
.photo-slot-preview { width: 100%; aspect-ratio: 4/3; background: #111; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.photo-slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot-footer { padding: 6px 10px; display: flex; align-items: center; justify-content: space-between; background: white; }
.photo-slot-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.photo-slot-new-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); display: inline-block; }
.photo-slot-btn { background: none; border: none; font-size: 0.72rem; font-weight: 700; color: var(--red); cursor: pointer; padding: 2px 0; }

/* RESPONSIVE */
@media (max-width: 860px) { .admin-content { padding: 14px; } }
