:root {
  --teal: #01696F;
  --teal-dark: #014f54;
  --teal-light: #E0F2F1;
  --grey-50: #f7f8f9;
  --grey-100: #eef0f2;
  --grey-200: #e2e5e9;
  --grey-400: #9aa3ad;
  --grey-600: #5b6572;
  --grey-800: #2a313a;
  --white: #ffffff;
  --red: #e5484d;
  --orange: #f5a623;
  --green: #2e7d32;
  --blue: #2196F3;
  --purple: #9C27B0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 40, 0.08), 0 1px 2px rgba(20, 30, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--grey-50);
  color: var(--grey-800);
  font-size: 14px;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--teal);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 16px;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 12px;
}
.sidebar .brand small { display: block; font-weight: 400; opacity: 0.75; font-size: 11px; margin-top: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
}
.nav-link:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,0.16); color: var(--white); font-weight: 600; border-right: 3px solid var(--white); }
.nav-spacer { flex: 1; }
.nav-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 12px;
}
.nav-user .role { opacity: 0.75; }
.nav-user form { margin-top: 8px; }
.nav-user button {
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.nav-user button:hover { background: rgba(255,255,255,0.22); }

/* ---- Main ---- */
.main { flex: 1; min-width: 0; padding: 24px 32px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; margin: 0; }
.page-header .sub { color: var(--grey-600); font-size: 13px; margin-top: 4px; }

.flash { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.flash.ok { background: #e6f4ea; color: var(--green); border: 1px solid #b7dfc0; }
.flash.err { background: #fdecea; color: var(--red); border: 1px solid #f5c2c2; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--grey-200);
  background: var(--white);
  color: var(--grey-800);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--grey-100); text-decoration: none; }
.btn-primary { background: var(--teal); color: var(--white); border-color: var(--teal); }
.btn-primary:hover { background: var(--teal-dark); }
.btn-danger { background: var(--white); color: var(--red); border-color: #f5c2c2; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Cards / KPIs ---- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi-card .num { font-size: 28px; font-weight: 700; color: var(--teal); line-height: 1.1; }
.kpi-card .label { color: var(--grey-600); font-size: 12px; margin-top: 4px; }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card h2 { font-size: 15px; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--white); white-space: nowrap; }
.badge-outline { background: none; border: 1px solid var(--grey-200); color: var(--grey-600); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--grey-600); padding: 8px 10px; border-bottom: 1px solid var(--grey-200); }
td { padding: 10px; border-bottom: 1px solid var(--grey-100); font-size: 13px; vertical-align: middle; }
tr:hover td { background: var(--grey-50); }
.table-wrap { overflow-x: auto; }

/* ---- Filters ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.filter-bar select, .filter-bar input[type=text], .filter-bar input[type=date] {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--grey-200); font-size: 13px; background: var(--white);
}

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 14px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--grey-600); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--grey-200); font-size: 13px; font-family: inherit; background: var(--white);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grey-200); margin-bottom: 20px; }
.tab {
  padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--grey-600);
  border-bottom: 2px solid transparent; cursor: pointer;
}
.tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab:hover { color: var(--teal-dark); text-decoration: none; }

/* ---- Kanban ---- */
.board { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 12px; }
.kanban-col { background: var(--grey-100); border-radius: var(--radius); width: 260px; flex-shrink: 0; padding: 10px; min-height: 200px; }
.kanban-col-header { display: flex; align-items: center; gap: 8px; padding: 6px 6px 12px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.kanban-col-count { background: var(--white); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--grey-600); }
.kanban-card {
  background: var(--white); border-radius: 8px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 10px;
  cursor: grab; border-left: 4px solid var(--grey-400);
}
.kanban-card.dragging { opacity: 0.4; }
.kanban-col.drag-over { background: var(--teal-light); }
.kanban-card .title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.kanban-card .meta { font-size: 11px; color: var(--grey-600); display: flex; justify-content: space-between; margin-top: 6px; }
.kanban-card .overdue { color: var(--red); font-weight: 700; }
.kanban-card select { margin-top: 8px; width: 100%; font-size: 11px; padding: 4px; border-radius: 6px; border: 1px solid var(--grey-200); }

/* ---- Progress bar ---- */
.progress { background: var(--grey-200); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-fill { background: var(--teal); height: 100%; }

/* ---- Activity feed ---- */
.activity-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grey-100); }
.activity-item:last-child { border-bottom: none; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--teal-light); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.activity-body .who { font-weight: 600; font-size: 13px; }
.activity-body .text { font-size: 13px; color: var(--grey-800); }
.activity-body .when { font-size: 11px; color: var(--grey-400); }

/* ---- Login ---- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--teal) 0%, var(--teal-dark) 100%); }
.login-card { background: var(--white); border-radius: 16px; padding: 40px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.login-card h1 { font-size: 18px; margin: 0 0 4px; color: var(--teal-dark); }
.login-card .sub { color: var(--grey-600); font-size: 13px; margin-bottom: 24px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--grey-600); }
.muted { color: var(--grey-600); }
.right { text-align: right; }
.stack-sm > * + * { margin-top: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--grey-600); margin: 20px 0 10px; }
