* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
body { background: #f1f5f9; color: #1e293b; min-height: 100vh; }
body.login-bg { background: #0f172a; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* Login Card */
.card { background: #ffffff; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.12); padding: 32px; width: 100%; max-width: 420px; }
.logo { max-height: 65px; display: block; margin: 0 auto 14px; }
.text-center { text-align: center; }
h1 { font-size: 24px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.subtitle { font-size: 14px; color: #64748b; margin-bottom: 24px; }

/* Forms & Buttons */
.form-group { margin-bottom: 16px; text-align: left; }
label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
input, select, textarea { width: 100%; padding: 11px 14px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,0.15); }
.btn { display: inline-block; width: 100%; padding: 12px; background: #1d4ed8; color: #fff; font-weight: 600; font-size: 15px; border: none; border-radius: 8px; cursor: pointer; text-align: center; text-decoration: none; transition: 0.2s; }
.btn:hover { background: #1e40af; }
.btn-sm { width: auto; padding: 8px 15px; font-size: 13px; border-radius: 7px; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-amber { background: #d97706; }
.btn-amber:hover { background: #b45309; }
.btn-dark { background: #334155; }
.btn-dark:hover { background: #1e293b; }
.alert-err { background: #fef2f2; border-left: 4px solid #ef4444; color: #b91c1c; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.footer-note { font-size: 12px; color: #94a3b8; margin-top: 20px; text-align: center; }

/* Top Navbar */
.navbar { background: #0f172a; color: #fff; padding: 14px 28px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.12); flex-wrap: wrap; gap: 12px; }
.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-logo { height: 34px; background: #fff; padding: 4px 8px; border-radius: 6px; object-fit: contain; }
.nav-title { font-weight: 700; font-size: 16px; letter-spacing: 0.5px; }
.nav-actions { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.user-pill { background: #1e293b; padding: 6px 12px; border-radius: 99px; color: #e2e8f0; font-size: 12px; }

/* Dashboard Container & Cards */
.container { max-width: 1000px; margin: 32px auto; padding: 0 20px; }
.page-header { background: #ffffff; padding: 24px 28px; border-radius: 14px; border: 1px solid #e2e8f0; margin-bottom: 24px; box-shadow: 0 2px 6px rgba(0,0,0,0.03); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

.tile { background: #ffffff; padding: 26px; border-radius: 14px; border: 1px solid #e2e8f0; text-decoration: none; color: inherit; display: flex; flex-direction: column; justify-content: space-between; text-align: left; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.04); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.tile.active { border: 2px solid #2563eb; background: linear-gradient(to bottom right, #ffffff, #eff6ff); }
.tile.active:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(37,99,235,0.12); }
.tile.wip { opacity: 0.78; background: #f8fafc; }
.tile.wip:hover { opacity: 0.95; background: #ffffff; }
.tile h2 { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.tile p { font-size: 13.5px; color: #64748b; line-height: 1.45; }
.tile-footer { margin-top: 16px; font-size: 13px; font-weight: 600; color: #2563eb; }

/* Status Badges */
.badge { display: inline-block; width: fit-content; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 99px; margin-bottom: 12px; letter-spacing: 0.4px; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }

/* HSG Workspace Tabs, Panels, Camera & History */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn { padding: 10px 16px; background: #e2e8f0; color: #334155; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.tab-btn.active { background: #1d4ed8; color: #ffffff; }
.panel { display: none; background: #ffffff; padding: 22px; border-radius: 12px; border: 1px solid #e2e8f0; }
.panel.active { display: block; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.task-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid #cbd5e1; }
.task-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.task-item input { width: auto; }
.cam-btn { background: #0f172a; color: #ffffff !important; padding: 11px 16px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; font-size: 14px; }
.cam-btn:hover { background: #1e293b; }
.gallery { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ok { background: #dcfce7; border-left: 4px solid #16a34a; color: #166534; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
#cameraModal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.88); z-index: 9999; align-items: center; justify-content: center; padding: 16px; }
.cam-box { background: #0f172a; color: #ffffff; padding: 16px; border-radius: 12px; width: 100%; max-width: 500px; text-align: center; }
#cameraFeed { width: 100%; border-radius: 8px; background: #000; max-height: 60vh; }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
th, td { padding: 9px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #334155; }
.thumb { width: 68px; height: 52px; object-fit: cover; border-radius: 5px; margin: 2px; border: 1px solid #cbd5e1; }
