/* ═══════════════════════════════════════════════
   DESIGN SYSTEM — ProgressHub
   Palette: Alpine Frost + Copper accents
   Font: Plus Jakarta Sans + Instrument Serif
═══════════════════════════════════════════════ */

:root {
  --bg:          #F0F4F8;
  --surface:     #FFFFFF;
  --surface2:    #F7F9FC;
  --border:      #E2E8F0;
  --border2:     #CBD5E1;

  --primary:     #2E5090;
  --primary-lt:  #3B63B3;
  --primary-bg:  #EBF0FA;

  --accent:      #B87333;
  --accent-lt:   #D4A574;
  --accent-bg:   #FDF3E7;

  --text:        #0A1929;
  --text2:       #4A5568;
  --text3:       #94A3B8;

  --green:       #16A34A;
  --green-bg:    #DCFCE7;
  --orange:      #EA580C;
  --orange-bg:   #FFF0E6;
  --yellow:      #CA8A04;
  --yellow-bg:   #FEF9C3;
  --red:         #DC2626;
  --red-bg:      #FEE2E2;
  --blue:        #2563EB;
  --blue-bg:     #DBEAFE;

  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);

  --font:        'Plus Jakarta Sans', sans-serif;
  --font-serif:  'Instrument Serif', serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.active { display: flex !important; }

/* ═══════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════ */
#page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #0A1929 0%, #1B3A6B 50%, #2E5090 100%);
  overflow: hidden;
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .25;
}
.orb1 { width: 500px; height: 500px; background: #3B63B3; top: -150px; left: -100px; }
.orb2 { width: 400px; height: 400px; background: #B87333; bottom: -100px; right: -80px; }
.orb3 { width: 300px; height: 300px; background: #7B68EE; top: 40%; left: 50%; transform: translate(-50%,-50%); }

.login-card {
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,.97);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
  backdrop-filter: blur(12px);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-lt));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}
.logo-icon.small { width: 34px; height: 34px; font-size: 16px; border-radius: 8px; }

.logo-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -.3px;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.login-sub {
  color: var(--text2);
  font-size: .9rem;
  margin-bottom: 24px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-hint {
  text-align: center;
  color: var(--text3);
  font-size: .8rem;
  margin-top: 16px;
}

/* ═══════════════════════════════════════════════
   LANGUAGE TOGGLE
═══════════════════════════════════════════════ */
.lang-toggle-wrap {
  display: flex;
  gap: 4px;
  background: var(--border);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
  margin-bottom: 20px;
}
.lang-toggle-wrap.small { margin-bottom: 0; }

.lang-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text2);
  transition: all .2s;
}
.lang-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(46,80,144,.3);
}

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,80,144,.12);
}

.form-group textarea { resize: vertical; min-height: 70px; }

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-lt));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(46,80,144,.35); }
.btn-primary.full-width { width: 100%; padding: 13px; font-size: 1rem; }

.btn-secondary {
  padding: 10px 20px;
  background: var(--surface);
  color: var(--text2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border2); }

.btn-back {
  padding: 8px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text2);
  transition: all .2s;
}
.btn-back:hover { background: var(--bg); }

.btn-logout {
  width: 100%;
  padding: 9px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.8);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  margin-top: 8px;
}
.btn-logout:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.4); }

.btn-export {
  padding: 8px 16px;
  background: var(--green-bg);
  color: var(--green);
  border: 1.5px solid #86EFAC;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.btn-export:hover { background: #BBF7D0; }
.btn-export.red { background: var(--red-bg); color: var(--red); border-color: #FCA5A5; }
.btn-export.red:hover { background: #FECACA; }

/* ═══════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════ */
#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0A1929 0%, #1B3A6B 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header .logo-text { color: white; font-size: 1.1rem; flex: 1; }

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: rgba(255,255,255,.15); color: white; font-weight: 700; }

.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-lt));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  color: white;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { color: white; font-size: .85rem; font-weight: 700; }
.user-role { color: rgba(255,255,255,.5); font-size: .75rem; }

/* ── MAIN WRAP ── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text2);
  padding: 4px;
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notif-bell {
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background .2s;
}
.notif-bell:hover { background: var(--bg); }

/* ── CONTENT PAGES ── */
.content-page {
  display: none;
  flex-direction: column;
  padding: 28px 28px;
  flex: 1;
  gap: 24px;
}
.content-page.active { display: flex; }

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  flex: 1;
}

/* ═══════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.accent-blue  { border-left-color: var(--blue); }
.accent-orange{ border-left-color: var(--orange); }
.accent-yellow{ border-left-color: var(--yellow); }
.accent-green { border-left-color: var(--green); }

.stat-icon { font-size: 2rem; }
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: .8rem;
  color: var(--text2);
  font-weight: 500;
  margin-top: 2px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.meeting-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.meeting-item:last-child { border-bottom: none; }

.meeting-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}

.meeting-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}
.meeting-date {
  font-size: .78rem;
  color: var(--text3);
  margin-top: 2px;
}

.factory-mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.factory-mini-item:last-child { border-bottom: none; }
.factory-mini-item:hover { background: var(--bg); border-radius: 6px; padding-left: 6px; }

.factory-mini-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}
.factory-mini-loc {
  font-size: .78rem;
  color: var(--text3);
}
.factory-mini-badge {
  font-size: .75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ═══════════════════════════════════════════════
   FACTORIES
═══════════════════════════════════════════════ */
.factory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.factory-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s;
  border: 1.5px solid transparent;
  position: relative;
  overflow: hidden;
}
.factory-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.factory-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-bg);
}

.factory-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.factory-icon {
  width: 42px; height: 42px;
  background: var(--primary-bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

.industry-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
}

.factory-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.factory-name-mr {
  font-size: .82rem;
  color: var(--text3);
  margin-bottom: 10px;
}

.factory-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.factory-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text2);
}

.factory-stats {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.fstat {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  background: var(--bg);
}
.fstat-num { font-size: .95rem; font-weight: 800; }
.fstat-lbl { font-size: .68rem; color: var(--text3); font-weight: 500; }
.fstat.p .fstat-num { color: var(--orange); }
.fstat.i .fstat-num { color: var(--yellow); }
.fstat.d .fstat-num { color: var(--green); }

/* ═══════════════════════════════════════════════
   FACTORY DETAIL — TASK COLUMNS
═══════════════════════════════════════════════ */
.detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.detail-meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface);
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
  box-shadow: var(--shadow);
}

.task-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}

.task-col {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 300px;
}

.task-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
}

.col-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pending-dot { background: var(--orange); }
.inprog-dot  { background: var(--yellow); }
.done-dot    { background: var(--green); }

.task-count {
  margin-left: auto;
  background: var(--border);
  color: var(--text2);
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-left: 3px solid transparent;
  transition: all .2s;
}
.task-card:hover { box-shadow: var(--shadow); transform: translateX(2px); }
.task-card.pending { border-left-color: var(--orange); }
.task-card.inprog  { border-left-color: var(--yellow); }
.task-card.done    { border-left-color: var(--green); }

.task-title {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.task-title-mr {
  font-size: .78rem;
  color: var(--text3);
  margin-bottom: 6px;
}
.task-dept {
  font-size: .75rem;
  color: var(--text2);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}
.task-assigned {
  font-size: .75rem;
  color: var(--text3);
}
.task-remark {
  font-size: .75rem;
  color: var(--text2);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-style: italic;
}
.task-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.task-btn {
  padding: 3px 10px;
  border: none;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.task-btn.edit { background: var(--primary-bg); color: var(--primary); }
.task-btn.del  { background: var(--red-bg); color: var(--red); }
.task-btn:hover { opacity: .8; }

/* ═══════════════════════════════════════════════
   REPORTS
═══════════════════════════════════════════════ */
.export-btns { display: flex; gap: 8px; }

.report-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.rsummary-chip {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}
.report-table th {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.report-table td {
  padding: 12px 16px;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: var(--bg); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
}
.badge.pending { background: var(--orange-bg); color: var(--orange); }
.badge.inprog  { background: var(--yellow-bg); color: var(--yellow); }
.badge.done    { background: var(--green-bg);  color: var(--green); }
.badge.total   { background: var(--blue-bg);   color: var(--blue); }

/* ═══════════════════════════════════════════════
   CALENDAR
═══════════════════════════════════════════════ */
.calendar-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.cal-month-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.cal-nav {
  width: 34px; height: 34px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  color: var(--text2);
}
.cal-nav:hover { background: var(--primary); color: white; border-color: var(--primary); }

.cal-grid {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.cal-grid > div:not(#cal-days-grid) {
  display: inline-block;
  width: calc(100% / 7);
  text-align: center;
  padding: 8px 4px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
}

#cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  padding: 4px;
}
.cal-day:hover { background: var(--primary-bg); }
.cal-day.today {
  background: var(--primary);
  color: white;
  font-weight: 800;
}
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-day.today.has-event::after { background: white; }
.cal-day.other-month { color: var(--text3); }

.events-list-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.events-list-wrap h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.event-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.event-item:last-child { border-bottom: none; }

.event-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 4px;
  flex-shrink: 0;
}
.event-dot.meeting    { background: var(--blue); }
.event-dot.inspection { background: var(--orange); }
.event-dot.training   { background: var(--green); }

.event-title {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
}
.event-date {
  font-size: .78rem;
  color: var(--text3);
  margin-top: 2px;
}
.event-type-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  display: inline-block;
}
.event-person {
  font-size: .78rem;
  color: var(--text2);
  margin-top: 4px;
  font-weight: 600;
}
.meeting-person {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   TEAM
═══════════════════════════════════════════════ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.member-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.member-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-lt));
}
.member-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.member-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-lt));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  margin: 0 auto 12px;
  position: relative;
  z-index: 1;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.member-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.member-role {
  font-size: .8rem;
  color: var(--text2);
  margin-bottom: 8px;
}
.member-dept-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--primary-bg);
  color: var(--primary);
  margin-bottom: 8px;
}
.member-factory {
  font-size: .78rem;
  color: var(--text3);
}

.member-del-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,.2);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: .75rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: all .2s;
  z-index: 2;
}
.member-del-btn:hover { background: rgba(220,38,38,.8); }

/* ═══════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,25,41,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}
.modal-close {
  background: var(--bg);
  border: none;
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text2);
  transition: all .2s;
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal form { display: flex; flex-direction: column; gap: 14px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 6px;
}

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .calendar-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sidebar-close { display: block; }
  .main-wrap { margin-left: 0; }
  .hamburger { display: block; }
  .task-columns { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-page { padding: 16px; }
  .login-card { padding: 32px 24px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .report-table { font-size: .78rem; }
  .report-table th, .report-table td { padding: 8px 10px; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: .875rem; }