/* KC Manpower — labour workforce shell */
:root {
  --bg: #dce8ef;
  --bg-panel: #ffffff;
  --ink: #12263a;
  --muted: #4d6274;
  --line: #c5d3de;
  --line-strong: #9eb3c4;
  --header: #0a3d5c;
  --header-2: #0d4f73;
  --accent: #0d7a5c;
  --accent-soft: #e6f5f0;
  --ok: #1a6b4a;
  --ok-bg: #e6f6ee;
  --warn: #b56a12;
  --danger: #a1262a;
  --danger-bg: #fdecec;
  --menu-master: #1b6f9c;
  --menu-master-bg: #e4f2fa;
  --menu-entries: #0d7a5c;
  --menu-entries-bg: #e4f6ef;
  --menu-reports: #b56a12;
  --menu-reports-bg: #f8eedc;
  --menu-utils: #4f6378;
  --menu-utils-bg: #eef1f4;
  --menu-help: #8a4a16;
  --menu-help-bg: #fff4e8;
  --menu-dash: #176f66;
  --menu-dash-bg: #e4f4f2;
  --radius: 4px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(10, 61, 92, 0.06), transparent 160px),
    radial-gradient(900px 280px at 8% -8%, rgba(27, 111, 156, 0.12), transparent 55%),
    var(--bg);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: #f0f4f7;
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.topbar {
  display: flex;
  align-items: stretch;
  min-height: 56px;
  border-bottom: 2px solid var(--header);
  background: linear-gradient(180deg, var(--header-2) 0%, var(--header) 100%);
  color: #e8f1f6;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 3px 0 var(--accent), 0 8px 18px rgba(8, 24, 36, 0.22);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 170px;
  padding: 0.55rem 1rem;
  border-right: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.12);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.35);
  background: #0c6b8a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.brand-name { font-weight: 700; font-size: 0.98rem; color: #fff; }
.brand-sub { font-size: 0.72rem; color: rgba(232,241,246,0.7); text-transform: uppercase; letter-spacing: 0.05em; }

.nav {
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0 0.4rem;
  flex: 1;
}
.menu-link, .menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.78rem;
  margin: 0.55rem 0.12rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #e8f1f6;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.menu-dash .menu-btn { background: rgba(23, 111, 102, 0.55); }
.menu-master .menu-btn { background: rgba(27, 111, 156, 0.55); }
.menu-entries .menu-btn { background: rgba(13, 122, 92, 0.55); }
.menu-reports .menu-btn { background: rgba(181, 106, 18, 0.55); }
.menu-utils .menu-btn { background: rgba(79, 99, 120, 0.55); }
.menu-help .menu-btn { background: rgba(138, 74, 22, 0.55); }
.menu-link:hover, .menu-btn:hover, .menu-link.active, .menu-btn.active {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.35);
}
.menu-drop { position: relative; display: flex; }
.menu-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  max-height: 80vh;
  overflow-y: auto;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--menu-master);
  box-shadow: 0 8px 20px rgba(10, 61, 92, 0.18);
  z-index: 50;
}
.menu-drop.open .menu-panel, .menu-drop:hover .menu-panel { display: block; }
.menu-dash .menu-panel { border-top-color: var(--menu-dash); }
.menu-master .menu-panel { border-top-color: var(--menu-master); }
.menu-entries .menu-panel { border-top-color: var(--menu-entries); }
.menu-reports .menu-panel { border-top-color: var(--menu-reports); }
.menu-utils .menu-panel { border-top-color: var(--menu-utils); }
.menu-help .menu-panel { border-top-color: var(--menu-help); }
.menu-panel a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid #eef3f6;
  font-weight: 600;
  font-size: 0.92rem;
}
.menu-panel a:hover, .menu-panel a.active { background: var(--menu-master-bg); }
.menu-dash .menu-panel a:hover, .menu-dash .menu-panel a.active { background: var(--menu-dash-bg); }
.menu-entries .menu-panel a:hover, .menu-entries .menu-panel a.active { background: var(--menu-entries-bg); }
.menu-reports .menu-panel a:hover, .menu-reports .menu-panel a.active { background: var(--menu-reports-bg); }
.menu-utils .menu-panel a:hover, .menu-utils .menu-panel a.active { background: var(--menu-utils-bg); }
.menu-help .menu-panel a:hover, .menu-help .menu-panel a.active { background: var(--menu-help-bg); }
.mi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--mono);
  border: 1px solid #7fb8bc;
  border-radius: 2px;
  background: var(--menu-master-bg);
  color: var(--menu-master);
}
.menu-dash .mi { background: var(--menu-dash-bg); color: var(--menu-dash); border-color: #7eb9c9; }
.menu-entries .mi { background: var(--menu-entries-bg); color: var(--menu-entries); border-color: #86c9a0; }
.menu-reports .mi { background: var(--menu-reports-bg); color: var(--menu-reports); border-color: #93b0d4; }
.menu-utils .mi { background: var(--menu-utils-bg); color: var(--menu-utils); border-color: #a0aec0; }
.menu-help .mi { background: var(--menu-help-bg); color: var(--menu-help); border-color: #e2b57a; }
.caret { font-size: 0.7rem; opacity: 0.8; }

.menu-quit {
  display: inline-flex;
  align-items: center;
  margin: 0.55rem 0.45rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255,180,180,0.45);
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffd4d4;
  background: rgba(155, 28, 28, 0.35);
  align-self: center;
  height: auto;
}
.menu-quit:hover {
  background: var(--danger);
  color: #fff;
  border-color: #fff;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  border-left: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.1);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.35);
  background: #0c6b8a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: 0.88rem; color: #fff; }
.user-meta em { font-style: normal; font-size: 0.72rem; color: rgba(232,241,246,0.7); text-transform: uppercase; }

.main {
  padding: 1.15rem clamp(0.85rem, 2.5vw, 1.75rem) 2.5rem;
  max-width: 1360px;
  margin: 0 auto;
  min-height: calc(100vh - 96px);
}
.main-login {
  max-width: none;
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
body:has(.main-login) { background: #071a2c; }
body:has(.main-login) .site-footer { display: none; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--accent);
}
.page-head h1, h1 {
  margin: 0 0 0.2rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--header);
}
h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--header);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}
aside h2, .panel h2 {
  margin: 0 0 0.7rem;
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--header) 0%, var(--header-2) 100%);
  color: #fff;
  font-size: 0.95rem;
}
.muted { color: var(--muted); }
.tiny { font-size: 0.78rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.48rem 0.9rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { background: #f3f7fa; border-color: var(--accent); }
.btn-primary { background: var(--header); border-color: var(--header); color: #fff; }
.btn-primary:hover { background: var(--header-2); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,0.4); color: #e8f1f6; }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-sm { padding: 0.28rem 0.55rem; font-size: 0.82rem; }
.btn-danger { color: var(--danger); border-color: #e8b4b4; }
.btn-danger:hover { background: var(--danger-bg); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
.stat {
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.stat:nth-child(1) { border-left-color: #b45309; }
.stat:nth-child(2) { border-left-color: #0c6b8a; }
.stat:nth-child(3) { border-left-color: #1e4a7a; }
.stat:nth-child(4) { border-left-color: #0d5c63; }
.stat:nth-child(5) { border-left-color: #1b6b3a; }
.stat:nth-child(6) { border-left-color: #4a5568; }
.stat:hover { background: var(--accent-soft); }
.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.split {
  display: grid;
  grid-template-columns: 1.7fr 0.9fr;
  gap: 0.9rem;
}
.table-wrap, aside, .panel, .form {
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 6px 16px rgba(18, 38, 58, 0.05);
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.62rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--header);
  font-weight: 600;
}
tbody tr:nth-child(even) { background: #f5f8fa; }
tbody tr:hover { background: var(--accent-soft); }
.row-actions { display: flex; gap: 0.35rem; white-space: nowrap; }
.row-actions form { display: inline; }

aside, .panel { padding: 0.9rem 1rem; }
.form.stack { display: grid; gap: 0.7rem; }
.form label { display: grid; gap: 0.25rem; font-weight: 600; font-size: 0.88rem; }
.form label span { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.form input[type="text"],
.form input[type="password"],
.form input[type="date"],
.form input[type="time"],
.form input[type="email"],
.form input[type="number"],
.form textarea,
.form select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 0.42rem 0.55rem;
  font: inherit;
  background: #fff;
}
.form input[type="checkbox"] { width: auto; justify-self: start; }
.form input.readonly, input.readonly {
  background: #f1f5f9;
  cursor: not-allowed;
}

.company-panel { max-width: 980px; padding: 1.1rem 1.2rem 1.4rem; }
.form-section {
  margin-bottom: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0.8rem; }
.form-section h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #176f66, #1b6f9c);
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.form-group { display: grid; gap: 0.28rem; }
.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 0.42rem 0.55rem;
  font: inherit;
  background: #fff;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.7rem;
  font-weight: 600;
}
.routine-products {
  max-height: 11rem;
  overflow: auto;
  padding: 0.25rem 0.15rem;
  min-width: 16rem;
}
.routine-prod-row {
  margin-top: 0.35rem;
  font-weight: 500;
  flex-wrap: wrap;
}
.routine-prod-row .prod-label {
  flex: 1 1 8rem;
  min-width: 0;
}
.routine-prod-row .prod-qty {
  font-weight: 400;
}
.perm-block {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}
.perm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  cursor: pointer;
  list-style: none;
}
.perm-head::-webkit-details-marker { display: none; }
.perm-count {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-left: auto;
}
.perm-preview, .perm-users {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  font-size: 0.88rem;
}
.perm-preview ul, .perm-users ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}
.perm-matrix-wrap { margin-top: 0.4rem; }
.perm-matrix table { font-size: 0.86rem; }
.perm-matrix th, .perm-matrix td { white-space: nowrap; }
.perm-matrix .center { text-align: center; }
.perm-section-row td {
  background: #f1f5f8;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.emp-form-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.4rem;
  align-items: start;
}
.photo-panel {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.photo-title { font-weight: 600; font-size: 0.82rem; margin: 0 0 0.7rem; color: var(--muted); }
.photo-preview {
  width: 160px;
  height: 160px;
  border-radius: 10px;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 36, 51, 0.12);
  background: #e2e8f0;
  margin: 0 auto 0.85rem;
  display: block;
}
.roster-wrap { overflow: auto; max-width: 100%; }
.roster-table { font-size: 11px; min-width: 900px; }
.roster-table .day-col { min-width: 58px; text-align: center; padding: 2px; }
.roster-table .day-col select { width: 100%; font-size: 10px; padding: 2px; }
.roster-table .from-default { background: #f0fdf4; }
.roster-table .sticky-col {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  white-space: nowrap;
  min-width: 130px;
}
.roster-table .sticky-col2 {
  position: sticky;
  left: 130px;
  background: #fff;
  z-index: 1;
  white-space: nowrap;
  min-width: 70px;
}
.roster-table thead .sticky-col,
.roster-table thead .sticky-col2 { background: var(--header); color: #fff; }
.photo-placeholder {
  width: 160px;
  height: 160px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dbeafe, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
  color: var(--muted);
  font-size: 2.6rem;
  border: 2px dashed #cbd5e1;
}

@media (max-width: 960px) {
  .form-grid, .emp-form-layout { grid-template-columns: 1fr; }
}

.flash-wrap { display: grid; gap: 0.4rem; margin-bottom: 0.85rem; }
.flash {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.flash-ok { background: var(--ok-bg); border-color: #9ad0b0; color: var(--ok); }
.flash-error { background: var(--danger-bg); border-color: #f0b4b4; color: var(--danger); }

.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin: 0.35rem 0; }

.site-footer {
  text-align: center;
  padding: 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* —— Login (Split Screen) —— */
.login-page {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  background: #f4f7f9;
}
.login-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}
.login-brand-side {
  flex: 1.2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background:
    radial-gradient(ellipse 90% 70% at 12% 15%, rgba(14, 116, 144, 0.5), transparent 55%),
    radial-gradient(ellipse 75% 55% at 88% 85%, rgba(15, 118, 110, 0.38), transparent 52%),
    radial-gradient(circle at 50% 110%, rgba(8, 47, 73, 0.55), transparent 45%),
    linear-gradient(165deg, #061522 0%, #0a3d5c 46%, #0b5878 100%);
  color: #fff;
  overflow: hidden;
}
.brand-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}
.brand-content {
  position: relative;
  z-index: 2;
  max-width: 480px;
  animation: fade-in-up 0.6s ease-out forwards;
}
.brand-logo-wrap {
  margin-bottom: 2rem;
}
.login-mark {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(145deg, #1288ad 0%, #0c6b8a 42%, #0a3d5c 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.brand-content h1 {
  font-size: 2.8rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: #fff;
  line-height: 1.1;
}
.login-lead {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin: 0;
}

.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 2rem;
  position: relative;
  box-shadow: -10px 0 30px rgba(0,0,0,0.05);
}
.login-form-container {
  width: 100%;
  max-width: 400px;
  animation: fade-in 0.8s ease-out forwards;
}
.login-form-header {
  margin-bottom: 2.5rem;
}
.login-eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}
.login-form-header h2 {
  font-size: 2rem;
  color: var(--header);
  margin: 0 0 0.5rem;
  padding: 0;
  border: none;
}
.login-help {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.input-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--header);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid #d1d9e0;
  background: #f9fbfd;
  font-size: 1rem;
  color: var(--ink);
  transition: all 0.2s ease;
}
.login-form input:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(13, 122, 92, 0.15);
}
.login-submit {
  margin-top: 1rem;
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 8px;
  background: var(--header);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 61, 92, 0.25);
  transition: all 0.2s ease;
}
.login-submit:hover {
  background: var(--header-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(10, 61, 92, 0.35);
}
.login-submit:active {
  transform: translateY(0);
}
.login-foot {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.8rem;
  color: #8a9ba8;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .login-split {
    flex-direction: column;
  }
  .login-brand-side {
    flex: none;
    padding: 3rem 2rem;
  }
  .login-form-side {
    padding: 3rem 2rem;
  }
  .brand-content h1 {
    font-size: 2.2rem;
  }
}

/* —— Master IO action buttons —— */
.page-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
}
.io-btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.io-import-form {
  display: inline;
  margin: 0;
}
.btn-io {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 7px;
  padding: 0.48rem 0.85rem;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(15, 36, 51, 0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-io:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 4px 10px rgba(15, 36, 51, 0.22);
  color: #fff !important;
}
.btn-io:active { transform: translateY(0); }
.io-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.35rem;
  padding: 0 0.28rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}
.btn-io-pdf {
  background: linear-gradient(180deg, #c24141 0%, #9b1c1c 100%);
}
.btn-io-import {
  background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
}
.btn-io-xls {
  background: linear-gradient(180deg, #15803d 0%, #166534 100%);
}

/* —— Dashboard ops —— */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #9ad0b0; }
.pill-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0b4b4; }
.dash-section { margin-bottom: 1.35rem; }
.dash-section > h2,
.dash-panel-head h2 {
  margin: 0 0 0.75rem;
  border: 0;
  padding: 0;
  font-size: 1rem;
}
.ops-row .stat-ops { border-left-width: 5px; }
.ops-row .stat:nth-child(1) { border-left-color: #1b6b3a; }
.ops-row .stat:nth-child(2) { border-left-color: #b45309; }
.ops-row .stat:nth-child(3) { border-left-color: #9b1c1c; }
.ops-row .stat:nth-child(4) { border-left-color: #1e4a7a; }
.ops-row .stat:nth-child(5) { border-left-color: #7c4a12; }
.ops-row .stat:nth-child(6) { border-left-color: #0d5c63; }
.stat-sub {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.dash-panel { padding: 1rem 1.1rem 1.15rem; }
.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.dash-panel-head h2 { margin: 0; }
.dash-table { border: 0; border-radius: 0; }
.dash-table th { font-size: 0.68rem; }
.dash-table td.num, .dash-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-empty { margin: 0.4rem 0 0.2rem; font-size: 0.9rem; }
.dash-empty-panel { max-width: 520px; margin-bottom: 1.2rem; }
.dash-masters { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  min-height: 160px;
  padding: 0.4rem 0.2rem 0;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}
.trend-bar-wrap {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #f0f5f8;
  border-radius: 4px 4px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
}
.trend-bar {
  width: 70%;
  min-height: 4px;
  background: linear-gradient(180deg, #0c6b8a, #0a3d5c);
  border-radius: 3px 3px 0 0;
}
.trend-n { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.trend-d { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.trend-label { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.quick-links a {
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.88rem;
}
.quick-links a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--header);
}

.plan-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
.plan-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 600;
  font-size: 0.88rem;
}
.plan-tab:hover { background: var(--accent-soft); border-color: var(--accent); }
.plan-tab.active {
  background: var(--header);
  border-color: var(--header);
  color: #fff;
}
.plan-apply-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}
.plan-apply-form select { min-width: 14rem; flex: 1; }
.plan-section { scroll-margin-top: 1rem; }
.plan-sec-title {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  color: #fff;
  font-size: 1.05rem;
}
.plan-sec-lc { background: linear-gradient(90deg, #0a3d5c, #1d4ed8); }
.plan-sec-ls { background: linear-gradient(90deg, #0f766e, #14b8a6); }
.plan-sec-hd { background: linear-gradient(90deg, #6d28d9, #7c3aed); }
.plan-sec-set { background: linear-gradient(90deg, #c2410c, #ea580c); }
.plan-section select { min-width: 14rem; width: 100%; }
.plan-page-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 8px 20px rgba(18, 38, 58, 0.12);
  z-index: 5;
}
.mp-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.7rem 0 1rem;
}
.mp-chart-box {
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem;
  background: #f8fbfd;
}
.modal-card-wide { width: min(1100px, 100%); }
.modal-card-sm { width: min(440px, 100%); }
.modal-confirm { z-index: 90; background: rgba(10, 36, 51, 0.55); }
.modal-body h3 { margin: 1rem 0 0.4rem; color: var(--header); font-size: 0.95rem; }
@media (max-width: 900px) {
  .mp-chart-grid { grid-template-columns: 1fr; }
}
.btn-apply {
  background: linear-gradient(180deg, #14b8a6 0%, #0d7a5c 100%);
  border-color: #0d7a5c;
  color: #fff;
  font-weight: 700;
}
.btn-apply:hover {
  background: #0a6550;
  color: #fff;
  border-color: #0a6550;
}

@media (max-width: 960px) {
  .split, .stat-row, .dash-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .userbox { border-left: 0; }
  .nav { flex-wrap: wrap; }
  .quick-links { grid-template-columns: 1fr; }
  .login-card { max-width: 400px; }
}

.routine-prod-row .prod-qty.qty-off,
.routine-prod-row .prod-qty:disabled {
  background: #eef1f4;
  color: #8a9aa8;
  border-color: #d0d8e0;
  box-shadow: none;
}
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem 0.3rem;
  flex-wrap: wrap;
}
.date-nav h2 { font-size: 1.05rem; }
.cont-emp-box {
  margin-top: 0.25rem;
  padding: 0.2rem 0.4rem;
  background: #f3f7fb;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.preview-card .preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 1rem;
}
.pstat {
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: 0 4px 10px rgba(18, 38, 58, 0.12);
}
.pstat span { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.9; }
.pstat strong { font-size: 1.55rem; }
.pstat-hod { background: linear-gradient(135deg, #c2410c, #9a3412); }
.pstat-con { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
.pstat-pr { background: linear-gradient(135deg, #0f766e, #115e59); }
.pstat-pg { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.pstat-em { background: linear-gradient(135deg, #15803d, #166534); }
.pstat-ce { background: linear-gradient(135deg, #0e7490, #155e75); }
.shift-chip {
  display: inline-block;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #155e75;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.preview-table tbody tr:nth-child(odd) { background: #f0f7fb; }
.email-box { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.pending-box { border-left: 5px solid var(--warn); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 36, 51, 0.45);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  background: #fff;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 10px;
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 24px 48px rgba(0,0,0,0.28);
}
@media print {
  .topbar, .site-footer, .page-head-actions, #routine-form, .email-box, .pending-box, .modal-backdrop { display: none !important; }
}

/* ── Pagination ─────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}
.pagination-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.pagination-links .btn-sm {
  min-width: 2rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
}
.pagination-dots {
  padding: 0 0.25rem;
  color: var(--muted);
}
.btn-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

/* ── Dark mode ──────────────────────────────── */
[data-theme="dark"] {
  --bg: #141824;
  --bg-panel: #1e2235;
  --ink: #d8dce8;
  --muted: #7e89a4;
  --line: #2e3450;
  --line-strong: #3e4568;
  --header: #0e1220;
  --header-2: #161c2e;
  --accent: #1aad80;
  --accent-soft: #162e28;
  --ok: #22c07a;
  --ok-bg: #14291f;
  --warn: #e09028;
  --danger: #e04848;
  --danger-bg: #2e1414;
  --menu-master: #3da0d0;
  --menu-master-bg: #162438;
  --menu-entries: #1aad80;
  --menu-entries-bg: #142e24;
  --menu-reports: #e09028;
  --menu-reports-bg: #2e2214;
  --menu-utils: #8094b0;
  --menu-utils-bg: #1c2030;
  --menu-help: #d08840;
  --menu-help-bg: #2a2014;
  --menu-dash: #20a898;
  --menu-dash-bg: #142e2a;
}
[data-theme="dark"] body {
  background: var(--bg);
}
[data-theme="dark"] .topbar {
  background: var(--header);
}
[data-theme="dark"] .stat, [data-theme="dark"] .stat-ops {
  background: var(--bg-panel);
  border-color: var(--line);
}
[data-theme="dark"] table thead {
  background: var(--header);
}
[data-theme="dark"] table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}
[data-theme="dark"] .panel {
  background: var(--bg-panel);
  border-color: var(--line);
}
[data-theme="dark"] .menu-panel {
  background: var(--bg-panel);
  border-color: var(--line);
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] aside {
  background: var(--bg-panel);
  border-color: var(--line);
}
[data-theme="dark"] .flash-ok { background: var(--ok-bg); color: var(--ok); }
[data-theme="dark"] .flash-error { background: var(--danger-bg); color: var(--danger); }

/* ── Theme toggle button ────────────────────── */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.12); }

/* ── Table search ───────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.table-search {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.88rem;
  width: 260px;
  max-width: 100%;
  background: var(--bg-panel);
  color: var(--ink);
}
.table-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.search-count {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Auto-refresh ───────────────────────────── */
.auto-refresh-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.auto-refresh-box button {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--ink);
  font-family: var(--font);
}
.auto-refresh-box span {
  color: var(--muted);
}

/* ── Hamburger ──────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

/* ── Mobile responsive ──────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .topbar {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
  }
  .brand { min-width: auto; }
  .main-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
  }
  .main-menu.nav-open { display: flex; }
  .menu-drop { width: 100%; }
  .menu-btn { width: 100%; text-align: left; padding: 0.6rem 0.5rem; }
  .menu-panel {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
    display: none;
  }
  .menu-drop.open .menu-panel { display: block; }
  .menu-quit {
    display: block;
    padding: 0.6rem 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .userbox { display: none; }

  .page-head { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .page-head-actions { flex-wrap: wrap; }

  .stat-row, .ops-row { grid-template-columns: repeat(2, 1fr); }

  .split { flex-direction: column; }
  .split > .table-wrap { width: 100%; }
  .split > aside { width: 100%; position: static; }

  .dash-grid { grid-template-columns: 1fr; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  .table-search { width: 100%; }
}

@media (max-width: 480px) {
  .stat-row, .ops-row { grid-template-columns: 1fr; }
  body { font-size: 14px; }
  .main { padding: 0.75rem; }
}

