:root {
  --bg: #07111f;
  --card: rgba(10, 24, 52, 0.92);
  --text: #f8fafc;
  --muted: #9fb0cf;
  --line: rgba(148, 163, 184, 0.16);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
  --radius: 20px;
  --sticky-row-width: 56px;
  --sticky-sku-width: 210px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line);
  padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.brand-title { font-size: 18px; font-weight: 700; margin: 0; }
.brand-sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip {
  background: var(--soft); color: var(--primary-dark); border: 1px solid #dbeafe; padding: 8px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.container { max-width: 1500px; margin: 0 auto; padding: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.section-title { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.section-sub { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-home { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
}
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: #fff; font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
button {
  border: none; border-radius: 12px; padding: 12px 16px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .18s ease;
}
button:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.auth-sub { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.password-input-wrap { position: relative; }
.password-input-wrap input { padding-right: 56px; }
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
  display: none !important;
  visibility: hidden;
}
.password-toggle-btn {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
  width: auto; min-width: auto; min-height: auto; padding: 4px 8px; border-radius: 6px;
  border: none; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; z-index: 5;
  font-size: 12px; font-weight: 700; cursor: pointer;
  line-height: 1; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.nav-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.nav-btn { background: #fff; border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 999px; }
.nav-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.home-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 165px; }
.home-card h3 { margin: 0 0 8px; font-size: 18px; }
.home-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.stat-card { padding: 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.stat-value { font-size: 30px; font-weight: 800; margin-top: 8px; }
.stat-sub { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; border: 1px solid transparent; white-space: nowrap;
}
.pill-success { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.pill-warning { background: #fff7ed; color: #3b82f6; border-color: #fed7aa; }
.pill-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.pill-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .field { min-width: 170px; flex: 1; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.table-wrap {
  overflow: auto; width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; -webkit-overflow-scrolling: touch;
}
#encodingTableWrap {
  max-height: calc(100vh - 320px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1100px; background: #fff; }
th, td {
  padding: 10px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  font-size: 13px; text-align: left; vertical-align: top; background: #fff;
}
th {
  position: sticky; top: 0; z-index: 3; background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .35px; color: var(--muted);
}
.encoding-table thead th {
  position: sticky; top: 0; z-index: 8; background: #f9fafb; box-shadow: 0 1px 0 var(--line);
}
th:last-child, td:last-child { border-right: none; }
.table-compact { min-width: 100%; }
.table-compact td, .table-compact th { padding: 9px 10px; }
.encoding-table { min-width: 980px; }
.row-no-cell, .row-no-head {
  width: var(--sticky-row-width); min-width: var(--sticky-row-width); max-width: var(--sticky-row-width);
  text-align: center; font-weight: 700;
}
.sku-cell, .sku-head {
  width: var(--sticky-sku-width); min-width: var(--sticky-sku-width); max-width: var(--sticky-sku-width); font-weight: 700;
}
.sku-cell {
  line-height: 1.25; white-space: normal; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word;
}
.sticky-col { position: sticky; left: 0; z-index: 2; background: #fff; }
.sticky-col-2 { position: sticky; left: var(--sticky-row-width); z-index: 2; background: #fff; }
thead .sticky-col, thead .sticky-col-2 { z-index: 10; background: #f9fafb; }
.encoding-table thead .sticky-col,
.encoding-table thead .sticky-col-2 { z-index: 12; box-shadow: 0 1px 0 var(--line); }
tbody tr:nth-child(even) td { background: #fcfcfd; }
tbody tr:nth-child(even) td.sticky-col, tbody tr:nth-child(even) td.sticky-col-2 { background: #fcfcfd; }
.num-input { min-width: 96px; text-align: right; padding: 10px 8px; border-radius: 10px; font-weight: 700; }
.remarks-input { min-width: 120px; }
.status-cell { text-align: center; font-weight: 700; white-space: nowrap; }
.status-nc { background: #fff7ed !important; color: #3b82f6; }
.status-os { background: #fef2f2 !important; color: #991b1b; }
.status-ok { background: #ecfdf3 !important; color: #166534; }
.status-check-end { background: #fff7ed !important; color: #3b82f6; }
.status-negative { background: #fef2f2 !important; color: #991b1b; }
.muted { color: var(--muted); }
.offtake-negative { color: #dc2626; font-weight: 700; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.triple-grid { display: grid; grid-template-columns: 1.1fr 1.1fr 1fr; gap: 16px; }
.list-card h3 { margin: 0 0 6px; font-size: 18px; }
.list-meta { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.store-list { display: flex; flex-direction: column; gap: 10px; max-height: 580px; overflow: auto; padding-right: 4px; }
.store-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.store-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.store-name { font-weight: 700; font-size: 14px; }
.store-meta { font-size: 12px; color: var(--muted); line-height: 1.55; }
.clickable-card { cursor: pointer; transition: .15s ease; }
.clickable-card:hover { border-color: #bfdbfe; box-shadow: 0 8px 18px rgba(37, 99, 235, .08); transform: translateY(-1px); }
.empty-state {
  padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; background: #fafafa;
}
.summary-box { background: #f9fafb; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.summary-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.summary-item .label { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.summary-item .value { margin-top: 8px; font-size: 22px; font-weight: 800; }
.toast {
  position: fixed; right: 18px; bottom: 18px; max-width: 360px; background: #111827; color: #fff; padding: 14px 16px;
  border-radius: 14px; box-shadow: 0 14px 30px rgba(0, 0, 0, .25); z-index: 200; font-size: 13px; line-height: 1.5;
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.loading-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); animation: pulse 1s infinite ease-in-out; }
@keyframes pulse { 0%,100% { transform: scale(.9); opacity: .5; } 50% { transform: scale(1.2); opacity: 1; } }
.detail-panel { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.detail-head { padding: 14px 16px; border-bottom: 1px solid var(--line); background: #f9fafb; }
.detail-title { margin: 0; font-size: 16px; font-weight: 700; }
.detail-sub { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.detail-body { padding: 14px 16px; max-height: 580px; overflow: auto; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.mini-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.mini-kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.mini-kpi .value { margin-top: 6px; font-size: 20px; font-weight: 800; }
.home-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.encoding-help {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 10px 0 12px;
  padding: 10px 12px; border: 1px dashed #bfdbfe; background: #f8fbff; border-radius: 12px; font-size: 12px; color: #1e40af;
}
.encoding-help strong { color: #1d4ed8; }
.summary-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.history-grid { display: grid; grid-template-columns: 1.15fr .95fr; gap: 16px; }
.comment-box {
  margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.comment-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .35px; margin-bottom: 8px; }
.comment-meta { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.comment-readonly {
  border: 1px solid var(--line); border-radius: 12px; background: #f9fafb; padding: 12px; line-height: 1.6; white-space: pre-wrap;
}
.comment-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.comment-row { display:grid; grid-template-columns: minmax(0,1fr) 220px; gap:10px; align-items:start; }
.status-select { min-width: 180px; }
.review-badge { display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; font-size:11px; font-weight:800; border:1px solid transparent; }
.review-pending { background:#fff7ed; color:#3b82f6; border-color:#fed7aa; }
.review-reviewed { background:#ecfdf3; color:#166534; border-color:#bbf7d0; }
.review-correction { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.review-na { background:#f3f4f6; color:#4b5563; border-color:#e5e7eb; }
.detail-summary-grid { display:grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap:10px; margin-bottom:12px; }
.detail-summary-card { border:1px solid var(--line); border-radius:12px; padding:10px; background:#fff; }
.detail-summary-card .label { font-size:11px; color:var(--muted); text-transform:uppercase; font-weight:700; }
.detail-summary-card .value { margin-top:6px; font-size:20px; font-weight:800; }
.detail-meta-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:10px; margin-bottom:12px; }
.detail-meta-box { border:1px solid var(--line); border-radius:12px; background:#f9fafb; padding:12px; font-size:12px; line-height:1.6; }
.detail-badges { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.row-highlight-os td { background: rgba(127, 29, 29, .42) !important; color: #fee2e2 !important; }
.row-highlight-expiry td { background: rgba(120, 53, 15, .42) !important; color: #ffedd5 !important; }
.row-highlight-remarks td {
  background: rgba(30, 64, 175, .24) !important; color: #dbeafe !important; box-shadow: inset 4px 0 0 #93c5fd;
}
.row-highlight-os td *, .row-highlight-expiry td *, .row-highlight-remarks td * { color: inherit !important; }
.quality-clean { background:#ecfdf3; color:#166534; border-color:#bbf7d0; }
.quality-warning-badge { background:#fff7ed; color:#3b82f6; border-color:#fed7aa; }
.quality-danger-badge { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.sku-subnote { margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.4; }
.num-input.input-suggested { background: #eff6ff; border-color: #bfdbfe; }
.num-input.input-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.quality-panel { margin-top: 12px; border-radius: 14px; padding: 14px; border: 1px solid var(--line); background: #fff; }
.quality-panel.hidden { display:none !important; }
.quality-title { margin: 0 0 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .35px; }
.quality-panel ul { margin: 0; padding-left: 18px; }
.quality-panel li { margin: 4px 0; line-height: 1.5; font-size: 13px; }
.quality-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.quality-warning { background: #fff7ed; border-color: #fed7aa; color: #3b82f6; }
.quality-info { background: #f8fbff; border-color: #dbeafe; color: #1d4ed8; }
.reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reference-item { background: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 12px; padding: 10px; }
.reference-item .label { font-size: 11px; text-transform: uppercase; font-weight: 700; opacity: .8; }
.reference-item .value { margin-top: 6px; font-size: 14px; font-weight: 700; line-height: 1.5; white-space: pre-wrap; }
.readonly-row input, .readonly-row textarea, .readonly-row select {
  background: #f3f4f6 !important; color: #6b7280 !important; border-color: #d1d5db !important; cursor: not-allowed !important;
}
.readonly-row .num-input, .readonly-row .remarks-input { background: #f3f4f6 !important; color: #6b7280 !important; }
.readonly-note {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb;
}
.enc-v2-toolbar {
  display: grid; gap: 14px; grid-template-columns: 180px minmax(300px, 1.25fr) minmax(260px, 1fr); align-items: start; margin-bottom: 12px;
}
.enc-v2-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.store-search-wrap { position: relative; }
.store-search-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 25; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 14px 28px rgba(0,0,0,.10); max-height: 320px; overflow: auto; padding: 6px;
}
.store-search-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
}
.store-search-item:hover { background: #f8fbff; }
.store-search-item.active { background: #eff6ff; }
.store-search-item.disabled { opacity: .65; cursor: not-allowed; background: #fafafa; }
.store-search-main { min-width: 0; }
.store-search-name { font-size: 14px; font-weight: 700; }
.store-search-meta { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.store-state-badge {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.store-state-done { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.store-state-pending { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.selected-summary {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 10px 12px; border: 1px dashed #dbeafe; border-radius: 12px; background: #f8fbff;
}
.selected-chip {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: #fff; border: 1px solid #dbeafe; color: #1d4ed8;
  font-size: 12px; font-weight: 700;
}
.principal-tabs { display: flex; gap: 8px; flex-wrap: wrap; min-height: 48px; align-items: center; }
.principal-tab {
  background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; white-space: nowrap;
}
.principal-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.principal-tab.completed { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.principal-tab.needs-correction { background: #fff7ed; color: #3b82f6; border-color: #fed7aa; }
.correction-alert { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid #fed7aa; background: #fff7ed; }
.correction-alert-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: #3b82f6; letter-spacing: .04em; }
.correction-alert-body { margin-top: 6px; font-size: 13px; color: #7c2d12; line-height: 1.6; }
.correction-alert-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.correction-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 999px; background: #fff; border: 1px solid #93c5fd; color: #3b82f6; font-size: 12px; font-weight: 700; }
.correction-action-box { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.attendance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.attendance-place-search-wrap { position: relative; }
.attendance-place-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 350;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 28px rgba(0,0,0,.10); max-height: 280px; overflow: auto; padding: 6px;
}
.attendance-place-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.attendance-place-item:hover { background: #f8fbff; }
.attendance-place-item.active { background: #eff6ff; }
.attendance-place-main { min-width: 0; }
.attendance-place-name { font-size: 14px; font-weight: 700; }
.attendance-place-meta { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.attendance-place-tag {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid #dbeafe; background: #eff6ff; color: #1d4ed8;
}
.attendance-user-search-wrap { position: relative; }
.attendance-user-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 260;
  background: #ffffff; border: 1px solid #d1d5db; border-radius: 14px;
  box-shadow: 0 14px 28px rgba(0,0,0,.18); max-height: 320px; overflow: auto; padding: 6px;
}
.attendance-user-item {
  display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; cursor: pointer; background: #ffffff;
}
.attendance-user-item:hover, .attendance-user-item.active { background: #eff6ff; }
.attendance-user-main { min-width: 0; }
.attendance-user-name { font-size: 14px; font-weight: 700; color: #111827; }
.attendance-user-meta { font-size: 12px; color: #6b7280; line-height: 1.45; margin-top: 2px; }
.attendance-status {
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #f9fafb; font-size: 13px; color: var(--muted); line-height: 1.6;
}
.fc-modal {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 300;
}
.fc-modal.hidden { display: none !important; }
.fc-modal-content {
  width: 100%; max-width: 520px; background: #fff; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.20); overflow: hidden; border: 1px solid var(--line);
}
.fc-modal-header, .fc-modal-footer {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.fc-modal-footer { border-bottom: none; border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; }
.fc-modal-body { padding: 16px; }
.fc-close-btn { border: none; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0; }
.attendance-log-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; max-height: 320px; overflow: auto; }
.attendance-log-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.attendance-log-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.attendance-log-meta { font-size: 12px; color: var(--muted); line-height: 1.55; }
.attendance-rule-box {
  margin-top: 14px; border: 1px dashed #bfdbfe; border-radius: 12px;
  background: #f8fbff; padding: 12px 14px; font-size: 12px; color: #1e40af; line-height: 1.6;
}
.attendance-manual-wrap.hidden { display: none !important; }

/* ===== DARK THEME OVERRIDES ===== */
html { background: radial-gradient(circle at top, #0f254d 0%, #07111f 46%, #040b16 100%); }
body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #0f254d 0%, #07111f 46%, #040b16 100%);
  color: var(--text);
}
.topbar {
  background: rgba(6, 15, 32, .86); border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(14px); box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
.brand-badge {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(180deg, #3b82f6, #2563eb); box-shadow: 0 12px 24px rgba(37,99,235,.28);
}
.brand-title { color: #fff; font-size: 22px; }
.brand-sub { color: #c7d2fe; font-size: 13px; }
.user-chip { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.08); color: #fff; }
.container { max-width: 1360px; padding: 20px 18px 110px; }
.card {
  background: linear-gradient(180deg, rgba(11,25,54,.94), rgba(8,18,40,.94));
  border: 1px solid rgba(255,255,255,.07); border-radius: 24px; box-shadow: 0 20px 44px rgba(0,0,0,.26);
}
.section-title { font-size: 28px; color: #fff; }
.section-sub { color: #9fb0cf; font-size: 14px; }
.field label, .stat-label, .summary-item .label, .comment-label { color: #9fb0cf; }
input, select, textarea {
  background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.10);
  color: #fff; min-height: 52px; border-radius: 16px;
}
input::placeholder, textarea::placeholder { color: #8ca0c8; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(37,99,235,.6); box-shadow: 0 0 0 4px rgba(37,99,235,.14);
}
button { min-height: 50px; border-radius: 16px; font-size: 15px; letter-spacing: .01em; }
.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb); box-shadow: 0 12px 24px rgba(37,99,235,.24);
}
.btn-primary:hover { background: linear-gradient(180deg, #93c5fd, #2563eb); }
.btn-secondary { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.10); }
.btn-secondary:hover { background: rgba(255,255,255,.10); }
.nav-row {
  gap: 12px; margin: 0 0 20px; position: sticky; top: 84px; z-index: 40;
  padding: 10px; background: rgba(6,15,32,.72); border: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(16px); border-radius: 999px; box-shadow: 0 14px 28px rgba(0,0,0,.20);
  overflow-x: auto; flex-wrap: nowrap;
}
.nav-btn { background: transparent; color: #dbe7ff; border: 1px solid transparent; min-height: 46px; padding: 10px 16px; flex: 0 0 auto; }
.nav-btn.active { background: linear-gradient(180deg, #3b82f6, #2563eb); color: #fff; box-shadow: 0 10px 20px rgba(37,99,235,.22); }
.home-hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-bottom: 18px; align-items: stretch; }
.hero-panel {
  min-height: 220px; padding: 26px;
  background: linear-gradient(135deg, rgba(17,37,80,.96), rgba(10,24,52,.94));
  border: 1px solid rgba(255,255,255,.08); border-radius: 28px; position: relative; overflow: hidden;
}
.hero-panel::after {
  content: ''; position: absolute; width: 220px; height: 220px; right: -80px; top: -60px;
  background: radial-gradient(circle, rgba(37,99,235,.34) 0%, rgba(37,99,235,0) 68%); pointer-events: none;
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: rgba(37,99,235,.12); color: #93c5fd; font-size: 12px; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
}
.hero-title { margin: 14px 0 8px; font-size: 32px; line-height: 1.1; color: #fff; }
.hero-desc { margin: 0; max-width: 540px; color: #9fb0cf; line-height: 1.65; font-size: 14px; }
.hero-actions { display:flex; gap:12px; flex-wrap:wrap; margin-top:20px; }
.hero-mini-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px; margin-top: 18px; }
.hero-mini { padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.hero-mini .label { font-size: 12px; color:#9fb0cf; text-transform: uppercase; font-weight: 700; }
.hero-mini .value { margin-top: 6px; font-size: 24px; color:#fff; font-weight:800; }
.home-role-summary-list { display:flex; flex-direction:column; gap:10px; margin-top:14px; }
.home-role-summary-item { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:12px 14px; border-radius:18px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.08); }
.home-role-summary-main { min-width:0; }
.home-role-summary-name { font-size:13px; font-weight:800; color:#fff; }
.home-role-summary-meta { margin-top:4px; font-size:12px; color:#9fb0cf; line-height:1.45; }
.home-role-summary-value { font-size:13px; font-weight:800; color:#93c5fd; white-space:nowrap; }
.grid-home { grid-template-columns: repeat(4, minmax(0,1fr)); }
.home-card {
  min-height: 200px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  transition: transform .18s ease, box-shadow .18s ease;
}
.home-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(0,0,0,.18); }
.home-card h3, .list-card h3, .detail-title { color: #fff; }
.home-card p, .list-meta, .store-meta, .muted, .detail-sub, .attendance-log-meta { color: #9fb0cf; }
.pill-info { background: rgba(59,130,246,.14); color:#bfdbfe; border-color: rgba(59,130,246,.22); }
.pill-success { background: rgba(34,197,94,.14); color:#bbf7d0; border-color: rgba(34,197,94,.22); }
.pill-warning { background: rgba(245,158,11,.16); color:#fde68a; border-color: rgba(245,158,11,.22); }
.pill-danger { background: rgba(239,68,68,.16); color:#fecaca; border-color: rgba(239,68,68,.22); }
.summary-box, .summary-item, .mini-kpi, .stat-card, .detail-panel, .detail-head,
.detail-summary-card, .detail-meta-box, .comment-box, .store-item, .attendance-log-item {
  background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08);
}
.stat-value, .summary-item .value, .mini-kpi .value, .detail-summary-card .value,
.store-name, .attendance-log-title { color:#fff; }
.table-wrap { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
table, th, td { background: transparent; border-color: rgba(255,255,255,.08); color: #e5eefc; }
th { background: rgba(255,255,255,.06); color:#9fb0cf; }
tbody tr:nth-child(even) td,
tbody tr:nth-child(even) td.sticky-col,
tbody tr:nth-child(even) td.sticky-col-2 { background: rgba(255,255,255,.02); }
.sticky-col, .sticky-col-2 { background: rgba(11,25,54,.97); }
thead .sticky-col, thead .sticky-col-2 { background: rgba(17,33,68,.97); }
.attendance-grid button { min-height: 64px; font-size: 17px; }
#btnCheckIn, #btnTimeIn { background: linear-gradient(180deg, #22c55e, #16a34a); box-shadow: 0 12px 24px rgba(34,197,94,.18); }
#btnCheckOut, #btnTimeOut { background: linear-gradient(180deg, #3b82f6, #2563eb); box-shadow: 0 12px 24px rgba(239,68,68,.18); color:#fff; border:none; }
.attendance-status, .attendance-rule-box { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08); color:#dbe7ff; }
.attendance-place-dropdown, .store-search-dropdown { background: #0d1d3f; border-color: rgba(255,255,255,.08); box-shadow: 0 18px 38px rgba(0,0,0,.28); }
.attendance-place-item:hover, .store-search-item:hover { background: rgba(255,255,255,.06); }
.attendance-place-tag, .store-state-badge, .selected-chip { background: rgba(37,99,235,.14); color:#93c5fd; border-color:; }
.fc-modal { background: rgba(2, 6, 23, .68); backdrop-filter: blur(10px); }
.fc-modal-content { background: linear-gradient(180deg, #0f2148, #0a1a37); border-color: rgba(255,255,255,.08); }
.fc-modal-header, .fc-modal-footer { border-color: rgba(255,255,255,.08); }
.fc-close-btn { color:#fff; }
.toast { background: rgba(2,6,23,.94); border: 1px solid rgba(255,255,255,.06); }
#attendanceView .card, #historyView .card, #profileView .card, #encodingView .card,
#managementDashboardView .card, #clientDashboardView .card, #adminResetView .card { border-radius: 26px; }

/* ===== INSTALL CARD ===== */
.install-card { border: 1px dashed #93c5fd; background: linear-gradient(135deg, #fff7ed, #ffffff); }
.install-row { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-top:10px; }
.install-note { font-size:12px; color: var(--muted); line-height:1.5; }
.app-chip { display:inline-flex; align-items:center; gap:6px; padding:7px 12px; border-radius:999px; font-size:12px; font-weight:700; background:#fff; border:1px solid #93c5fd; color:#c2410c; }
#btnInstallApp.hidden { display:none !important; }

/* ===== TOGGLE GRID ===== */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.toggle-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(255,255,255,.04); }
.toggle-item label { margin: 0; font-size: 13px; font-weight: 700; color: #fff; text-transform: none; letter-spacing: 0; }
.toggle-item input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; accent-color: var(--primary); cursor: pointer; }
.user-row-active { border-left: 4px solid #22c55e; }
.user-row-inactive { border-left: 4px solid #ef4444; }
.user-meta-line { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }

/* ===== ANNOUNCEMENTS ===== */
.announcement-stack { display:flex; flex-direction:column; gap:10px; margin-bottom:14px; }
.announcement-card {
  border: 1px solid rgba(249,115,22,.20);
  background: linear-gradient(180deg, rgba(37,99,235,.10), rgba(255,255,255,.035));
  border-radius: 18px; padding: 12px 14px;
}
.announcement-card h3 { margin:0; color:#fff; font-size:16px; line-height:1.2; }
.announcement-meta { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; }
.announcement-body { color:#e5eefc; font-size:13px; line-height:1.55; white-space:pre-wrap; }
.announcement-body-compact { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:4; overflow:hidden; }
.announcement-toggle { margin-top:8px; padding:0; min-height:auto; border:none; border-radius:0; background:transparent; color:#93c5fd; font-size:12px; font-weight:800; cursor:pointer; }
.announcement-toggle:hover { color:#fff; background:transparent; }
.announcement-composer { margin-bottom: 16px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); border-radius: 22px; padding: 16px; }
.announcement-composer-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
.announcement-composer-title { margin:0; color:#fff; font-size:18px; }
.announcement-composer-sub { margin:4px 0 0; color:#9fb0cf; font-size:13px; line-height:1.5; }
.announcement-empty { padding: 18px 16px; border-radius: 16px; border: 1px dashed rgba(255,255,255,.12); background: rgba(255,255,255,.03); color: #9fb0cf; font-size: 13px; text-align: center; }
.announcement-admin-wrap { margin-top:14px; border-top:1px solid rgba(255,255,255,.08); padding-top:14px; }
.announcement-admin-list { display:flex; flex-direction:column; gap:10px; }
.announcement-admin-item { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:12px 14px; border:1px solid rgba(255,255,255,.08); border-radius:16px; background:rgba(255,255,255,.04); }
.announcement-admin-main { min-width:0; flex:1; }
.announcement-admin-name { color:#fff; font-size:14px; font-weight:800; }
.announcement-admin-meta { margin-top:4px; color:#9fb0cf; font-size:12px; line-height:1.5; }
.announcement-admin-actions { display:flex; gap:8px; flex-wrap:wrap; }
.btn-xs { min-height:40px; padding:9px 12px; border-radius:12px; font-size:13px; }
.announcement-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:8px; }
.announcement-card-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* ===== READABLE DROPDOWNS ===== */
.attendance-place-dropdown, .store-search-dropdown {
  background: #ffffff !important; border: 1px solid #d1d5db !important; box-shadow: 0 14px 28px rgba(0,0,0,.18) !important;
}
.attendance-place-item, .store-search-item { background: #ffffff !important; }
.attendance-place-item:hover, .attendance-place-item.active,
.store-search-item:hover, .store-search-item.active { background: #eff6ff !important; }
.attendance-place-name, .store-search-name { color: #111827 !important; font-weight: 700 !important; }
.attendance-place-meta, .store-search-meta { color: #6b7280 !important; }
.attendance-place-tag, .store-state-badge { background: #fff7ed !important; color: #3b82f6 !important; border-color: #fed7aa !important; }
.selected-summary { background: #f8fafc !important; border: 1px solid #dbeafe !important; }
.selected-chip { background: #ffffff !important; color: #1f2937 !important; border: 1px solid #cbd5e1 !important; }
.principal-tab { background: #ffffff !important; color: #111827 !important; border: 1px solid #d1d5db !important; }
.principal-tab.completed { background: #f3f4f6 !important; color: #374151 !important; border-color: #d1d5db !important; }
.principal-tab.needs-correction { background: #fff7ed !important; color: #3b82f6 !important; border-color: #93c5fd !important; }
.principal-tab.active { background: linear-gradient(180deg, #3b82f6, #2563eb) !important; color: #ffffff !important; border-color: #2563eb !important; }
.encoding-table thead th, .table-compact thead th {
  background: #f8fafc !important; color: #111827 !important; border-color: #dbe3ee !important; font-weight: 800 !important;
}
.sticky-col, .sticky-col-2 { background: #0f2148 !important; }
thead .sticky-col, thead .sticky-col-2,
.encoding-table thead .sticky-col, .encoding-table thead .sticky-col-2 { background: #f8fafc !important; color: #111827 !important; }
.num-input, .remarks-input[type="date"], .remarks-input[type="text"] {
  background: #f8fafc !important; color: #111827 !important; border: 1px solid #cbd5e1 !important;
}
#attendanceView .table-compact { min-width: 860px !important; }
#attendanceView .table-compact th, #attendanceView .table-compact td { vertical-align: top !important; }
#attendanceView .table-compact td:nth-child(7) { max-width: 170px !important; white-space: normal !important; word-break: break-word !important; line-height: 1.25 !important; font-size: 12px !important; }

/* ===== RESPONSIVE ===== */
@media (max-width:1280px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .triple-grid, .history-grid { grid-template-columns: 1fr; }
}
@media (max-width:1100px) {
  .grid-home { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .home-hero { grid-template-columns: 1fr; }
}
@media (max-width:900px) {
  .enc-v2-toolbar { grid-template-columns: 1fr; }
  .principal-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .principal-tab { white-space: nowrap; }
  .comment-row, .detail-meta-grid { grid-template-columns: 1fr; }
  .detail-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  #companySetupView .grid[style*="340px"], #userManagementView .grid[style*="360px"] { grid-template-columns: 1fr !important; }
}
@media (max-width:760px) {
  :root { --sticky-row-width: 42px !important; --sticky-sku-width: 175px !important; }
  #encodingTableWrap { max-height: calc(100vh - 250px); }
  .topbar { padding: 14px 14px 12px; }
  .brand-title { font-size: 18px; }
  .brand-badge { width: 42px; height: 42px; border-radius: 14px; }
  .container { padding: 14px 12px 120px; max-width: 520px; }
  .section-title { font-size: 24px; }
  .kpi-grid, .summary-grid, .mini-kpis, .detail-summary-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .field { min-width: 100%; }
  .toolbar-actions, .summary-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .toolbar-actions button, .summary-actions button { width: 100%; }
  .nav-row {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto;
    margin: 0; padding: 8px; justify-content: space-between; gap: 8px; border-radius: 24px;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  }
  .nav-btn {
    font-size: 0 !important; line-height: 0 !important; min-height: 58px; padding: 8px 4px !important;
    flex: 1 1 0; min-width: 0; text-align: center;
  }
  .nav-btn::before { margin-bottom: 0 !important; font-size: 20px !important; }
  .nav-btn[data-view="homeView"]::before { content: "⌂"; display:block; }
  .nav-btn[data-view="attendanceView"]::before { content: "⏱"; display:block; }
  .nav-btn[data-view="encodingView"]::before { content: "▣"; display:block; }
  .nav-btn[data-view="historyView"]::before { content: "☰"; display:block; }
  .nav-btn[data-view="profileView"]::before { content: "◉"; display:block; }
  #navCompanySetup, #navUserManagement, #navOnboardingImport,
  #navAdminReset, #navManagementDashboard, #navClientDashboard { display: none !important; }
  .nav-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .nav-btn { white-space: nowrap; }
  .encoding-table { min-width: 920px !important; }
  .encoding-table th, .encoding-table td { padding: 8px 6px !important; }
  .sku-cell, .sku-head { width: var(--sticky-sku-width) !important; min-width: var(--sticky-sku-width) !important; max-width: var(--sticky-sku-width) !important; }
  .sku-cell { color: #f8fafc !important; font-size: 11px !important; line-height: 1.2 !important; white-space: normal !important; word-break: break-word !important; overflow: hidden !important; }
  .sku-subnote { font-size: 10px !important; line-height: 1.2 !important; color: #cbd5e1 !important; }
  .num-input { min-width: 64px !important; width: 64px !important; max-width: 64px !important; padding: 10px 6px !important; font-size: 16px !important; text-align: right !important; border-radius: 14px !important; }
  .remarks-input[type="date"] { min-width: 110px !important; width: 110px !important; max-width: 110px !important; border-radius: 14px !important; }
  .remarks-input[type="text"] { min-width: 110px !important; width: 110px !important; max-width: 110px !important; border-radius: 14px !important; }
  .encoding-table th:nth-child(3), .encoding-table td:nth-child(3) { width: 50px !important; min-width: 50px !important; max-width: 50px !important; }
  .hero-panel { padding: 18px; }
  .hero-title { font-size: 22px; }
  .hero-desc { font-size: 13px; max-width: 340px; }
  .hero-mini-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-mini .value { font-size: 20px; }
  .grid-home { grid-template-columns: 1fr 1fr; gap: 12px; }
  .home-card { min-height: 150px; padding: 16px; }
  .home-card h3 { font-size: 15px; line-height: 1.15; }
  .home-card p { display: none; }
  .home-badges { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .attendance-grid button { min-height: 58px; }
  button, input, select, textarea { font-size: 16px; }
  #attendanceView .grid[style*="1.05fr"] { grid-template-columns: 1fr !important; }
  .attendance-place-item { padding: 12px 12px !important; }
  .attendance-place-name { font-size: 15px !important; }
  .attendance-place-meta { font-size: 12px !important; }
  .principal-tabs { overflow-x: auto !important; flex-wrap: nowrap !important; padding-bottom: 4px !important; }
  .principal-tab { flex: 0 0 auto !important; min-width: 108px !important; text-align: center !important; }
  .home-card button { margin-top: 10px; }
  .hero-desc { max-width: 340px; }
  .attendance-place-tag { display: none; }
  .attendance-place-meta:empty { display:none; }
  .store-search-meta { font-size: 11px; }
  .selected-summary { gap: 6px; }
  .selected-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .sku-cell, .sku-head { overflow: hidden; text-overflow: ellipsis; }
}