:root {
  --iw-green-dark: #1b5e35;
  --iw-green: #2e8b57;
  --iw-green-light: #e8f5ee;
  --iw-white: #ffffff;
  --iw-warning: #f4b400;
  --iw-danger: #d64545;
  --iw-text: #223026;
  --iw-border: #dbe8de;
  --iw-sidebar-w: 250px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: #f4f8f5;
  color: var(--iw-text);
  margin: 0;
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--iw-green-dark), var(--iw-green));
}
.login-card {
  background: var(--iw-white);
  width: 100%;
  max-width: 380px;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card .brand {
  text-align: center;
  margin-bottom: 24px;
}
.login-card .brand .logo-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--iw-green-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
}
.login-card h1 {
  font-size: 18px;
  margin: 0 0 4px;
  color: var(--iw-green-dark);
}
.login-card p.sub {
  font-size: 13px;
  color: #6b7d70;
  margin: 0;
}

/* ===== LAYOUT ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--iw-sidebar-w);
  background: var(--iw-green-dark);
  color: #fff;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar .sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .sidebar-brand .icon { font-size: 26px; }
.sidebar .sidebar-brand h2 { font-size: 15px; margin: 0; line-height: 1.3; }
.sidebar .sidebar-brand small { opacity: .75; font-size: 11px; }

.sidebar nav { padding: 12px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: #d9ece1;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a .ic { width: 20px; text-align: center; }
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-left-color: var(--iw-warning);
  font-weight: 600;
}
.sidebar nav .nav-section {
  padding: 14px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .55;
}

.main-content {
  margin-left: var(--iw-sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--iw-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 {
  font-size: 18px;
  margin: 0;
  color: var(--iw-green-dark);
}
.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.topbar .user-chip .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--iw-green-light);
  color: var(--iw-green-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.role-pill {
  font-size: 11px;
  background: var(--iw-green-light);
  color: var(--iw-green-dark);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.page-body { padding: 22px 24px 60px; }

.btn-toggle-sidebar {
  display: none;
  background: none; border: none; font-size: 20px; cursor: pointer; color: var(--iw-green-dark);
}

/* ===== CARDS ===== */
.card-iw {
  background: #fff;
  border: 1px solid var(--iw-border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card-iw .card-header-iw {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-iw .card-header-iw h3 {
  font-size: 15px; margin: 0; color: var(--iw-green-dark);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--iw-border);
  border-left: 5px solid var(--iw-green);
  border-radius: 10px;
  padding: 16px 18px;
}
.stat-card.warn { border-left-color: var(--iw-warning); }
.stat-card.danger { border-left-color: var(--iw-danger); }
.stat-card .label { font-size: 12px; color: #6b7d70; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 24px; font-weight: 700; color: var(--iw-text); margin-top: 4px; }
.stat-card .sub { font-size: 12px; color: #8a988e; margin-top: 2px; }

/* ===== TABLE ===== */
.table-iw-wrap { overflow-x: auto; }
table.table-iw {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.table-iw th {
  background: var(--iw-green-light);
  color: var(--iw-green-dark);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  white-space: nowrap;
}
table.table-iw td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--iw-border);
  vertical-align: middle;
}
table.table-iw tbody tr:hover { background: #f6faf7; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #e3f6e9; color: #1b7a3d; }
.badge-warning { background: #fef3d6; color: #94720b; }
.badge-danger  { background: #fbe2e2; color: #a92222; }
.badge-info    { background: #dcf0fa; color: #1f6f94; }
.badge-secondary { background: #eee; color: #666; }

/* ===== FORMS / BUTTONS ===== */
.form-label { font-size: 13px; font-weight: 600; color: var(--iw-text); margin-bottom: 4px; display: block; }
.form-control, select.form-control, textarea.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--iw-border);
  border-radius: 8px;
  font-size: 13.5px;
}
.form-control:focus { outline: none; border-color: var(--iw-green); box-shadow: 0 0 0 3px rgba(46,139,87,0.15); }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--iw-green); color: #fff; }
.btn-primary:hover { background: var(--iw-green-dark); }
.btn-outline { background: #fff; color: var(--iw-green-dark); border: 1px solid var(--iw-green); }
.btn-outline:hover { background: var(--iw-green-light); }
.btn-danger { background: var(--iw-danger); color: #fff; }
.btn-warning { background: var(--iw-warning); color: #4a3900; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; position: relative; }
.alert-success { background: #e3f6e9; color: #1b7a3d; }
.alert-danger { background: #fbe2e2; color: #a92222; }
.alert-info { background: #dcf0fa; color: #1f6f94; }
.btn-close { position: absolute; right: 12px; top: 10px; background: none; border: none; cursor: pointer; font-size: 15px; }

.gauge-wrap { text-align: center; }
.gauge-value { font-size: 26px; font-weight: 700; color: var(--iw-green-dark); }

/* Waste symbol icons */
.symbol-box {
  width: 70px; height: 70px;
  border: 3px solid #000;
  background: #fff200;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}

/* Label B3 print sheet */
.label-b3 {
  width: 15cm; height: 20cm;
  background: #fff200;
  color: #000;
  border: 6px solid #000;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 20px auto;
  font-family: Arial, sans-serif;
}
.label-b3 h2 { text-align:center; margin:0 0 6px; font-size:20px; letter-spacing:1px;}
.label-b3 .symbol-area { display:flex; justify-content:center; padding: 10px 0; }
.label-b3 table { width:100%; border-collapse: collapse; font-size: 13px; }
.label-b3 table td { border: 2px solid #000; padding: 6px 8px; }
.label-b3 .warn-strip { background:#000; color:#fff200; text-align:center; font-weight:700; padding:6px; font-size:14px; letter-spacing:1px;}

@media print {
  .no-print { display: none !important; }
  .label-b3 { margin: 0; box-shadow: none; }
  body { background: #fff; }
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .btn-toggle-sidebar { display: inline-block; }
}
