/* ═══════════════ RESET & VARIABLES ═══════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #714B67;
  --primary-dark:  #5a3a52;
  --primary-hover: #875f7e;
  --primary-light: #f3edf1;
  --accent:        #00A09D;
  --bg:            #f5f5f5;
  --sidebar-bg:    #2c2c2c;
  --white:         #ffffff;
  --text:          #212529;
  --text-muted:    #8f8f8f;
  --border:        #e8e8e8;
  --success:       #28a745;
  --warning:       #e9a825;
  --danger:        #dc3545;
  --info:          #17a2b8;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 8px rgba(0,0,0,.04);
  --shadow-md:     0 4px 20px rgba(0,0,0,.12);
}

body { font-family: 'Roboto', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }

/* ═══════════════ UTILITIES ═══════════════ */
.hidden { display: none !important; }
.flex   { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.text-muted { color: var(--text-muted); font-size: .85rem; }

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border: none; border-radius: 6px;
  font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.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(--border); }
.btn-secondary:hover { background: #f5f5f5; border-color: #ccc; }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: .9; }
.btn-sm { padding: 5px 12px; font-size: .80rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ═══════════════════════════════════════════
   SCREEN 1 – LOGIN SELECTOR
═══════════════════════════════════════════ */
#screen-selector {
  min-height: 100vh;
  background: linear-gradient(140deg, #714B67 0%, #3d2440 60%, #1a0f1d 100%);
  display: flex; align-items: center; justify-content: center;
}

.selector-box {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 48px 56px;
  text-align: center;
  color: #fff;
  max-width: 520px; width: 90%;
}

.selector-logo { font-size: 2rem; font-weight: 700; letter-spacing: 2px; margin-bottom: 4px; color: #fff; }
.selector-logo span { color: #e8b4d8; }
.selector-tagline { font-size: .85rem; opacity: .7; margin-bottom: 40px; }

.selector-cards { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }

.selector-card {
  background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: 28px 32px;
  cursor: pointer;
  transition: all .25s;
  flex: 1; min-width: 160px;
}
.selector-card:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.5);
  transform: translateY(-3px);
}
.selector-card i  { font-size: 2.2rem; margin-bottom: 12px; display: block; }
.selector-card h3 { font-size: 1rem; font-weight: 600; }
.selector-card p  { font-size: .78rem; opacity: .65; margin-top: 4px; }
.card-internal i { color: #e8b4d8; }
.card-portal   i { color: #7ee8e6; }

/* ═══════════════════════════════════════════
   SCREEN 2 – LOGIN FORM
═══════════════════════════════════════════ */
#screen-login {
  min-height: 100vh;
  background: linear-gradient(140deg, #714B67 0%, #3d2440 60%, #1a0f1d 100%);
  display: flex; align-items: center; justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 44px;
  width: 380px; max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo-text { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.login-brand .logo-badge {
  display: inline-block; font-size: .7rem; background: var(--primary);
  color: #fff; border-radius: 20px; padding: 2px 10px; margin-top: 4px;
}

.form-group { margin-bottom: 18px; }
.form-group label { font-size: .82rem; font-weight: 500; color: #555; display: block; margin-bottom: 5px; }
.form-group input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .92rem; transition: border .2s, box-shadow .2s;
  outline: none;
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(113,75,103,.15); }

.login-btn {
  width: 100%; padding: 11px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.login-btn:hover { background: var(--primary-dark); }

.login-back { text-align: center; margin-top: 16px; font-size: .82rem; }
.login-back a { color: var(--primary); cursor: pointer; text-decoration: none; }
.login-back a:hover { text-decoration: underline; }

.login-hint {
  margin-top: 18px; padding: 10px 14px;
  background: #f8f4f7; border-radius: var(--radius);
  font-size: .78rem; color: #777;
}
.login-hint strong { color: var(--primary); }

/* ═══════════════════════════════════════════
   SCREEN 3 – INTERNAL APP SHELL
═══════════════════════════════════════════ */
#screen-app { min-height: 100vh; display: flex; flex-direction: column; }

/* Top Nav — Odoo 17 style */
.topnav {
  height: 50px;
  background: var(--primary);
  display: flex; align-items: center;
  padding: 0 8px; gap: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,.12);
}

.topnav-apps-btn {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.9); cursor: pointer;
  transition: background .15s; flex-shrink: 0;
}
.topnav-apps-btn:hover { background: rgba(0,0,0,.18); }
.topnav-apps-btn i { font-size: 1rem; }

.topnav-logo {
  font-size: .95rem; font-weight: 700; color: #fff;
  padding: 0 10px 0 4px; letter-spacing: .5px; white-space: nowrap;
  cursor: pointer; opacity: .95;
}
.topnav-logo:hover { opacity: 1; }

.topnav-divider { width: 1px; height: 24px; background: rgba(255,255,255,.2); margin: 0 4px; }

.topnav-menu { display: flex; align-items: center; flex: 1; height: 100%; }
.topnav-menu a {
  color: rgba(255,255,255,.85); font-size: .84rem; font-weight: 500;
  padding: 0 14px; height: 100%; display: flex; align-items: center;
  text-decoration: none; cursor: pointer; transition: background .15s, color .15s;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.topnav-menu a:hover  { background: rgba(0,0,0,.12); color: #fff; }
.topnav-menu a.active { color: #fff; border-bottom-color: rgba(255,255,255,.7); }

.topnav-right { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.topnav-search {
  display: flex; align-items: center;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px; padding: 5px 14px; gap: 7px;
  transition: background .2s;
}
.topnav-search:focus-within { background: rgba(255,255,255,.2); }
.topnav-search input { background: transparent; border: none; outline: none; color: #fff; font-size: .83rem; width: 180px; }
.topnav-search input::placeholder { color: rgba(255,255,255,.55); }
.topnav-search i { color: rgba(255,255,255,.65); font-size: .82rem; }

.topnav-icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85); cursor: pointer;
  transition: background .15s;
  position: relative;
}
.topnav-icon-btn:hover { background: rgba(0,0,0,.18); color: #fff; }
.topnav-icon-btn .badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: #fff;
  font-size: .58rem; width: 13px; height: 13px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

.topnav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.22); color: #fff;
  font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-left: 2px;
  border: 1.5px solid rgba(255,255,255,.3);
  transition: border-color .15s;
}
.topnav-avatar:hover { border-color: rgba(255,255,255,.7); }

/* App Body */
.app-body { display: flex; flex: 1; }

/* Breadcrumb */
.breadcrumb-bar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 8px 24px; font-size: .82rem; color: var(--text-muted);
}
.breadcrumb-bar span { color: var(--primary); cursor: pointer; }
.breadcrumb-bar span:hover { text-decoration: underline; }

/* Content area */
.app-content { flex: 1; padding: 0; overflow-y: auto; }

/* ═══════════════════════════════════════════
   HOME – APP LAUNCHER  (Odoo 17 style)
═══════════════════════════════════════════ */
.app-launcher-title {
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 28px;
}

.app-grid { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }

.app-tile {
  width: 116px; height: 116px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; border-radius: 12px;
  transition: background .15s, box-shadow .15s;
  text-align: center; gap: 10px;
}
.app-tile:hover { background: rgba(113,75,103,.07); }

.app-tile-icon {
  width: 60px; height: 60px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.65rem; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.app-tile span { font-size: .76rem; color: var(--text); font-weight: 500; line-height: 1.3; }

.tile-employees  .app-tile-icon { background: linear-gradient(135deg, #1abc9c, #16a085); }
.tile-records    .app-tile-icon { background: linear-gradient(135deg, #3498db, #2176ae); }
.tile-dashboard  .app-tile-icon { background: linear-gradient(135deg, #9b59b6, #7d3c98); }
.tile-settings   .app-tile-icon { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }

/* ═══════════════════════════════════════════
   MODULE VIEWS – shared list layout
═══════════════════════════════════════════ */
.module-view { padding: 0; }

.module-toolbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 6px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 48px;
}

.module-toolbar .view-tabs { display: flex; gap: 2px; background: #f5f5f5; border-radius: var(--radius); padding: 3px; }
.view-tab {
  padding: 5px 12px; font-size: .82rem; cursor: pointer;
  color: var(--text-muted); border-radius: 6px;
  transition: background .15s, color .15s;
}
.view-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.toolbar-sep { flex: 1; }

.search-bar-inline {
  display: flex; align-items: center; gap: 6px;
  background: #f8f8f8; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 10px;
}
.search-bar-inline input { border: none; background: transparent; outline: none; font-size: .83rem; width: 200px; }
.search-bar-inline i { color: var(--text-muted); font-size: .82rem; }

.filter-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border: 1px solid transparent;
  border-radius: 6px; background: transparent;
  font-size: .82rem; cursor: pointer; color: var(--text-muted);
  transition: background .15s, color .15s;
}
.filter-btn:hover { background: #f0f0f0; color: var(--text); }

/* List view */
.list-view { background: #fff; border-bottom: 1px solid var(--border); }

.list-header {
  display: grid; align-items: center;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-size: .75rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .6px; height: 38px;
}

.list-row {
  display: grid; align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid #f2f2f2;
  height: 48px; font-size: .875rem;
  cursor: pointer; transition: background .1s;
  background: #fff;
}
.list-row:hover { background: var(--primary-light); }

.list-check {
  width: 18px; height: 18px; border: 1px solid var(--border);
  border-radius: 3px; cursor: pointer; appearance: none;
  transition: background .15s, border-color .15s;
}
.list-check:checked { background: var(--primary); border-color: var(--primary); }

/* Status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.status-active   { background: #e8f5e9; color: #2e7d32; }
.status-inactive { background: #fafafa; color: #9e9e9e; border: 1px solid #e0e0e0; }
.status-pending  { background: #fff8e1; color: #f57f17; }
.status-done     { background: #e3f2fd; color: #1565c0; }
.status-draft    { background: #f3e5f5; color: #6a1b9a; }
.status-cancel   { background: #ffebee; color: #c62828; }

/* Kanban */
.kanban-view {
  display: flex; gap: 14px; padding: 20px; overflow-x: auto;
  background: var(--bg); min-height: 300px;
}
.kanban-col { min-width: 240px; background: #efefef; border-radius: 10px; padding: 10px; }
.kanban-col-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted); margin-bottom: 10px; padding: 2px 4px;
}
.kanban-card {
  background: #fff; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow); font-size: .83rem; cursor: pointer;
  transition: box-shadow .15s, transform .12s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card-title { font-weight: 600; margin-bottom: 5px; font-size: .86rem; }
.kanban-card-sub   { font-size: .76rem; color: var(--text-muted); line-height: 1.4; }

/* ═══════════════════════════════════════════
   DASHBOARD TABS
═══════════════════════════════════════════ */
.dash-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; font-size: .845rem; cursor: pointer;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s; font-weight: 500;
}
.dash-tab:hover { color: var(--text); }
.dash-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* OEE Gauge ring */
.oee-gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.oee-ring { transform: rotate(-90deg); }
.oee-bg   { fill: none; stroke: #f0f0f0; stroke-width: 10; }
.oee-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.oee-label { font-size: 1.5rem; font-weight: 700; }
.oee-sub   { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* Prediction cards */
.pred-card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.pred-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
}
.pred-badge.ai  { background: #ede7f6; color: #6a1b9a; }
.pred-badge.up  { background: #e8f5e9; color: #2e7d32; }
.pred-badge.warn{ background: #fff3e0; color: #e65100; }
.pred-badge.risk{ background: #ffebee; color: #c62828; }

/* Spark line (inline SVG) */
.spark-line { overflow: visible; }

/* Press metric row */
.press-row {
  display: grid; grid-template-columns: 120px 1fr 80px 80px 90px;
  align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #f2f2f2; font-size: .85rem;
}
.press-row:last-child { border-bottom: none; }
.progress-bar-wrap { background: #f0f0f0; border-radius: 20px; height: 8px; }
.progress-bar-fill { height: 100%; border-radius: 20px; transition: width .6s ease; }

/* ═══════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: #fff; border-radius: 12px;
  padding: 22px 24px; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  cursor: pointer; transition: box-shadow .2s, transform .15s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card.blue   { border-left-color: var(--info); }
.kpi-card.green  { border-left-color: var(--success); }
.kpi-card.yellow { border-left-color: var(--warning); }
.kpi-card.red    { border-left-color: var(--danger); }
.kpi-card.purple { border-left-color: var(--primary); }
.kpi-card.teal   { border-left-color: var(--accent); }

.kpi-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 6px 0 4px; }
.kpi-trend { font-size: .78rem; }
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.flat { color: var(--text-muted); }

.dashboard-row {
  display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px;
}
@media (max-width: 900px) { .dashboard-row { grid-template-columns: 1fr; } }

.dash-card {
  background: #fff; border-radius: 8px;
  padding: 20px; box-shadow: var(--shadow);
}
.dash-card-title {
  font-size: .88rem; font-weight: 600; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}

/* Bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-bottom: 0; }
.bar-wrap  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; justify-content: flex-end; }
.bar       { width: 100%; background: var(--primary); border-radius: 5px 5px 0 0; transition: opacity .2s; min-width: 28px; }
.bar:hover { opacity: .75; }
.bar-label { font-size: .7rem; color: var(--text-muted); }

/* Activity feed */
.activity-item {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f5f5f5; font-size: .83rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.activity-dot.green  { background: var(--success); }
.activity-dot.blue   { background: var(--info); }
.activity-dot.yellow { background: var(--warning); }
.activity-text { flex: 1; }
.activity-time { color: var(--text-muted); font-size: .75rem; white-space: nowrap; }

/* ═══════════════════════════════════════════
   EMPLOYEES – KANBAN CARDS
═══════════════════════════════════════════ */
.emp-kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px; padding: 20px;
}

/* ── Odoo-style employee card ── */
.emp-card {
  background: #fff; border-radius: 12px;
  box-shadow: var(--shadow); overflow: visible;
  cursor: pointer; transition: box-shadow .2s, transform .15s;
  position: relative;
}
.emp-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.emp-card-banner {
  height: 76px; border-radius: 12px 12px 0 0;
  position: relative;
}

.emp-card-avatar-wrap {
  position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%);
}
.emp-card-avatar-circle {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700; color: #fff;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.emp-card-info {
  padding: 36px 14px 14px;
  text-align: center;
  border-radius: 0 0 8px 8px;
}
.emp-card-name { font-weight: 700; font-size: .88rem; color: var(--text); }
.emp-card-pos  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }
.emp-card-dept {
  font-size: .72rem; color: var(--text-muted); margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.emp-card-footer {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ── Employee form/detail view ── */
.emp-detail-header {
  display: flex; align-items: flex-start; gap: 0;
}
.emp-detail-banner {
  height: 140px; border-radius: 8px 8px 0 0; position: relative;
  display: flex; align-items: flex-end; padding: 0 28px 16px;
}
.emp-detail-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 700; color: #fff;
  border: 4px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.2);
  position: absolute; bottom: -36px; left: 28px;
}
.emp-detail-title {
  position: absolute; bottom: 16px; left: 136px;
  color: #fff;
}
.emp-detail-title h2 { font-size: 1.2rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.3); }
.emp-detail-title p  { font-size: .83rem; opacity: .85; margin-top: 2px; }

.emp-detail-body { padding: 48px 28px 28px; }

.emp-detail-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.emp-detail-tab {
  padding: 8px 18px; font-size: .84rem; cursor: pointer;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: color .15s;
}
.emp-detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

.emp-detail-section { margin-bottom: 20px; }
.emp-detail-section-title {
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 12px;
}
.emp-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.emp-detail-field label {
  font-size: .72rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; display: block; margin-bottom: 3px;
}
.emp-detail-field .field-value {
  font-size: .88rem; color: var(--text); padding: 7px 10px;
  background: #f8f8f8; border-radius: var(--radius); border: 1px solid #eee;
}

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar {
  width: 224px; background: #fff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.sidebar-section { padding: 6px 0; }
.sidebar-label {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 16px 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 14px; font-size: .855rem; cursor: pointer;
  color: var(--text); transition: background .12s, color .12s;
  border-radius: 0; margin: 1px 8px; border-radius: 8px;
}
.sidebar-item i { width: 16px; text-align: center; font-size: .88rem; color: var(--text-muted); transition: color .12s; }
.sidebar-item:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-item:hover i { color: var(--primary); }
.sidebar-item.active {
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}
.sidebar-item.active i { color: var(--primary); }
.sidebar-badge {
  margin-left: auto; background: #e8e8e8; color: var(--text-muted);
  font-size: .68rem; padding: 1px 7px; border-radius: 20px; font-weight: 600;
}

/* ═══════════════════════════════════════════
   PORTAL SHELL
═══════════════════════════════════════════ */
#screen-portal { min-height: 100vh; display: flex; flex-direction: column; }

.portal-nav {
  background: #2c3e50;
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; gap: 24px;
  position: sticky; top: 0; z-index: 100;
}
.portal-nav-logo { font-size: 1.05rem; font-weight: 700; color: #fff; letter-spacing: 1px; }
.portal-nav-links { display: flex; gap: 0; flex: 1; height: 100%; }
.portal-nav-links a {
  color: rgba(255,255,255,.75); font-size: .85rem; padding: 0 16px;
  height: 100%; display: flex; align-items: center; cursor: pointer;
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.portal-nav-links a:hover  { color: #fff; }
.portal-nav-links a.active { color: #fff; border-bottom-color: var(--accent); }

.portal-nav-user {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.8); font-size: .83rem; cursor: pointer;
}
.portal-nav-user i { font-size: 1.1rem; }

.portal-body { flex: 1; padding: 28px 32px; }

.portal-page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.portal-page-sub   { font-size: .85rem; color: var(--text-muted); margin-bottom: 24px; }

.portal-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}

.portal-table-wrap {
  background: #fff; border-radius: 8px;
  box-shadow: var(--shadow); overflow: hidden;
}

.portal-table { width: 100%; border-collapse: collapse; }
.portal-table th {
  background: #f8f8f8; border-bottom: 2px solid var(--border);
  padding: 10px 16px; text-align: left;
  font-size: .78rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
}
.portal-table td { padding: 11px 16px; font-size: .87rem; border-bottom: 1px solid #f0f0f0; }
.portal-table tr:last-child td { border-bottom: none; }
.portal-table tr:hover td { background: #faf7fa; }
.portal-table .action-cell { display: flex; gap: 6px; align-items: center; }

/* ═══════════════════════════════════════════
   PRINT DIALOG OVERLAY
═══════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}

.print-dialog {
  background: #fff; border-radius: 10px;
  width: 720px; max-width: 96vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.print-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.print-dialog-header h3 { font-size: 1rem; font-weight: 600; }
.print-close {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #f5f5f5; font-size: 1rem;
  border: none; color: #555; transition: background .15s;
}
.print-close:hover { background: #e0e0e0; }

.print-preview { padding: 32px 40px; font-size: .88rem; }

.report-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 2px solid var(--primary);
}
.report-company-name { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.report-company-sub  { font-size: .78rem; color: var(--text-muted); }
.report-meta { text-align: right; font-size: .8rem; color: var(--text-muted); }
.report-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }

.report-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.report-table th { background: var(--primary); color: #fff; padding: 8px 12px; text-align: left; font-size: .8rem; }
.report-table td { padding: 7px 12px; border-bottom: 1px solid #eee; font-size: .82rem; }
.report-table tr:nth-child(even) td { background: #faf7fa; }

.report-footer {
  border-top: 1px solid var(--border); padding-top: 12px;
  font-size: .75rem; color: var(--text-muted); text-align: center;
}

.print-dialog-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--border);
  background: #fafafa;
}

/* Toast */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: #333; color: #fff; padding: 10px 18px;
  border-radius: 6px; font-size: .85rem; opacity: 0;
  transition: opacity .3s; pointer-events: none;
}

/* ═══════════════════════════════════════════
   PORTAL HOME ACTION CARDS
═══════════════════════════════════════════ */
.portal-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px; margin-top: 16px;
}
.portal-action-card {
  background: #fff; border-radius: 12px; padding: 28px 24px;
  text-align: center; cursor: pointer; box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .15s;
  border-top: 4px solid var(--primary); text-decoration: none; color: var(--text);
  display: block;
}
.portal-action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.portal-action-card .pac-icon { font-size: 2.4rem; margin-bottom: 12px; display: block; }
.portal-action-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.portal-action-card p { font-size: .8rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 14px; }
.portal-action-card .pac-link { font-size: .82rem; font-weight: 600; color: inherit; }
.pac-params { border-top-color: #3498db; } .pac-params .pac-icon { color: #3498db; } .pac-params .pac-link { color: #3498db; }
.pac-hora   { border-top-color: #1abc9c; } .pac-hora   .pac-icon { color: #1abc9c; } .pac-hora .pac-link { color: #1abc9c; }
.pac-check  { border-top-color: #f39c12; } .pac-check  .pac-icon { color: #f39c12; } .pac-check .pac-link { color: #f39c12; }

/* ═══════════════════════════════════════════
   FORM SECTIONS
═══════════════════════════════════════════ */
.form-section { background: #fff; border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.form-section-title {
  background: var(--primary); color: #fff; padding: 10px 18px;
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.form-section-title:hover { filter: brightness(1.1); }
.form-section-title .sec-chevron { margin-left: auto; font-size: .8rem; transition: transform .25s ease; opacity: .85; }
.form-section.collapsed .sec-chevron { transform: rotate(-90deg); }
.form-section-title.blue   { background: #2980b9; }
.form-section-title.green  { background: #27ae60; }
.form-section-title.orange { background: #e67e22; }
.form-section-title.gray   { background: #7f8c8d; }
.form-section-body {
  padding: 18px;
  max-height: 3000px;
  overflow: hidden;
  transition: max-height .3s ease, padding .25s ease, opacity .2s ease;
  opacity: 1;
}
.form-section.collapsed .form-section-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .form-grid-3, .form-grid-4 { grid-template-columns: 1fr 1fr; } }

.form-field { display: flex; flex-direction: column; gap: 3px; }
.form-field label { font-size: .75rem; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: .3px; }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .88rem; outline: none; transition: border .2s; width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px rgba(113,75,103,.1);
}
.form-field-span2 { grid-column: span 2; }
.form-field-span3 { grid-column: span 3; }

/* Process toggle */
.proceso-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.proceso-btn { flex: 1; padding: 9px; text-align: center; cursor: pointer; font-size: .88rem; font-weight: 700; transition: background .15s, color .15s; background: #f8f8f8; color: var(--text-muted); border: none; }
.proceso-btn.active.prog { background: #2980b9; color: #fff; }
.proceso-btn.active.man  { background: #27ae60; color: #fff; }

/* Inner table for troquel, amarres, estaños */
.inner-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.inner-table th { background: #f0e8ed; color: var(--primary); padding: 7px 10px; text-align: center; font-size: .78rem; font-weight: 700; border: 1px solid #ddd; }
.inner-table th.row-header { text-align: left; background: #f5f5f5; color: var(--text-muted); }
.inner-table td { border: 1px solid #e8e8e8; padding: 4px; }
.inner-table td.row-label { padding: 6px 10px; font-size: .82rem; color: #555; background: #fafafa; font-weight: 500; white-space: nowrap; }
.inner-table input { width: 100%; border: none; outline: none; text-align: center; padding: 5px; font-size: .85rem; background: transparent; }
.inner-table input:focus { background: #f5eef3; border-radius: 3px; }

/* Portal back bar */
.portal-back-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}
.portal-back-bar h2 { font-size: 1.1rem; font-weight: 700; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; cursor: pointer; font-size: .83rem; color: var(--text-muted);
  transition: background .15s;
}
.back-btn:hover { background: #f5f5f5; }

/* ═══════════════════════════════════════════
   CHECKLIST
═══════════════════════════════════════════ */
.checklist-wrap { background: #fff; border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.checklist-group-title {
  background: #2c3e50; color: #fff; padding: 9px 16px;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.checklist-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid #f0f0f0;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.has-no { background: #fff8f8; }
.cl-num {
  width: 22px; min-width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 2px; flex-shrink: 0;
}
.cl-content { flex: 1; }
.cl-question { font-size: .84rem; line-height: 1.5; margin-bottom: 0; }
.cl-accion { margin-top: 6px; }
.cl-accion input { width: 100%; padding: 5px 8px; border: 1px solid var(--danger); border-radius: var(--radius); font-size: .8rem; outline: none; }
.cl-options { display: flex; gap: 4px; flex-shrink: 0; margin-top: 1px; }
.cl-btn {
  padding: 5px 10px; border-radius: var(--radius); font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: background .12s, color .12s; border: 1.5px solid;
  min-width: 38px; text-align: center; background: #fff;
}
.cl-btn.si  { border-color: var(--success); color: var(--success); }
.cl-btn.si.sel  { background: var(--success); color: #fff; }
.cl-btn.no  { border-color: var(--danger);  color: var(--danger);  }
.cl-btn.no.sel  { background: var(--danger);  color: #fff; }
.cl-btn.na  { border-color: #aaa; color: #aaa; }
.cl-btn.na.sel  { background: #aaa; color: #fff; }

.checklist-warning {
  background: #fff3cd; border: 1px solid #ffc107; border-radius: 6px;
  padding: 12px 16px; font-size: .83rem; font-weight: 600; color: #856404;
  margin-bottom: 16px; text-align: center;
}

.signatures-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-top: 24px; }
.signature-box { text-align: center; }
.signature-line { border-top: 1px solid #333; padding-top: 6px; font-size: .78rem; color: #555; margin-top: 40px; }

/* ═══════════════════════════════════════════
   HORA X HORA TABLE
═══════════════════════════════════════════ */
.hora-table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 14px; }
.hora-table { border-collapse: collapse; min-width: 1200px; width: 100%; }
.hora-table th {
  background: var(--primary); color: #fff; padding: 7px 5px;
  font-size: .7rem; font-weight: 700; text-align: center;
  border: 1px solid rgba(255,255,255,.2); white-space: nowrap;
}
.hora-table th.subgroup { background: var(--primary-dark); font-size: .65rem; }
.hora-table td { border: 1px solid #e0e0e0; padding: 3px; }
.hora-table td.hora-cell { background: #f0e8ed; font-weight: 700; font-size: .8rem; text-align: center; padding: 4px 8px; white-space: nowrap; color: var(--primary); }
.hora-table input { width: 100%; border: none; outline: none; text-align: center; font-size: .82rem; padding: 5px 3px; background: transparent; }
.hora-table input:focus { background: #f5eef3; border-radius: 2px; }
.hora-table .calc { background: #f9f9f9; text-align: center; font-size: .8rem; padding: 5px 4px; color: var(--text-muted); font-weight: 600; }
.hora-table .calc.ok  { color: var(--success); }
.hora-table .calc.bad { color: var(--danger); }
.hora-table tr.total-row td { background: #f0e8ed; font-weight: 700; font-size: .82rem; }
.hora-table tr.total-row .hora-cell { background: var(--primary); color: #fff; }

/* ═══════════════════════════════════════════
   RECENT RECORDS MINI TABLE
═══════════════════════════════════════════ */
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th { background: #f5f5f5; padding: 7px 12px; font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); text-align: left; }
.mini-table td { padding: 8px 12px; font-size: .83rem; border-bottom: 1px solid #f5f5f5; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table tr:hover td { background: #faf7fa; }

/* ═══════════════════════════════════════════
   TYPE BADGES
═══════════════════════════════════════════ */
.tipo-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700; gap: 4px; }
.tipo-params    { background: #e3f2fd; color: #1565c0; }
.tipo-hora      { background: #e8f5e9; color: #2e7d32; }
.tipo-checklist { background: #fff3e0; color: #e65100; }

/* ═══════════════════════════════════════════
   TOLERANCE VALIDATION
═══════════════════════════════════════════ */
.tol-badge {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: .69rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  line-height: 1.6;
}
.tol-badge.ok    { display: inline-flex; background: #e8f5e9; color: #2e7d32; }
.tol-badge.error { display: inline-flex; background: #ffebee; color: #c62828; }
.tol-input.tol-ok    { border-color: #66bb6a !important; }
.tol-input.tol-error { border-color: #ef5350 !important; background: #fff5f5 !important; }
#tol-summary-banner {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 18px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
