:root {
  --ink: #1B2430;
  --ink-light: #2A3644;
  --ivory: #F5F3EE;
  --card: #FFFFFF;
  --hairline: #E1DDD1;
  --brass: #9C7A3C;
  --text: #2A2823;
  --muted: #7A7566;
  --danger: #B14B4B;
  --success: #4E9E7A;
  --warn: #B1763E;
  --info: #3E7CB1;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--ivory);
  color: var(--text);
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  font-size: 14.5px;
}
h1, h2, h3 { font-family: 'Source Serif 4', Georgia, serif; font-weight: 700; margin: 0; color: var(--ink); }
a { color: var(--brass); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D3CDBC; border-radius: 4px; }

/* ---- Shell / sidebar layout ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--ink); color: #D8DCE2;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand-block { display: flex; align-items: center; gap: 10px; padding: 22px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-mark {
  width: 36px; height: 36px; border: 1.5px solid var(--brass); color: var(--brass);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-family: 'Source Serif 4', serif; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.brand-mark-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; border-radius: 4px; }
.brand-name { font-family: 'Source Serif 4', serif; font-weight: 700; font-size: 14.5px; color: #F0EEE8; line-height: 1.25; }
.brand-sub { font-size: 11px; color: #8A93A0; letter-spacing: 0.3px; }
.nav-links { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-link {
  display: block; padding: 9px 12px; margin-bottom: 2px; border-radius: 5px;
  color: #C3C9D2; font-size: 13.5px; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: var(--brass); color: #1B2430; font-weight: 600; }
.nav-footer { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.nav-user { font-size: 13px; color: #E4E6EA; margin-bottom: 8px; }
.nav-role { display: block; font-size: 11px; color: #8A93A0; margin-top: 1px; }
.nav-link.logout { padding: 8px 12px; color: #A9AFB8; }
.nav-link.logout:hover { color: #fff; }

.content { flex: 1; padding: 30px 40px; min-width: 0; }
.page-title { font-size: 22px; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

/* ---- Flash messages ---- */
.flash { padding: 11px 16px; border-radius: 6px; font-size: 13.5px; margin-bottom: 20px; }
.flash-success { background: #E7F1EC; color: #2F6B4F; border: 1px solid #C9E0D3; }
.flash-error { background: #F5E7E7; color: #8F3A3A; border: 1px solid #E6C6C6; }

/* ---- Cards & stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1px solid var(--hairline); border-radius: 6px; padding: 16px 18px; }
.stat-value { font-family: 'Source Serif 4', serif; font-size: 26px; font-weight: 700; color: var(--ink); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }

.panel { background: var(--card); border: 1px solid var(--hairline); border-radius: 8px; padding: 22px 24px; margin-bottom: 22px; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; font-family: 'Source Serif 4', serif; color: var(--ink); }

/* ---- Tables ---- */
.data-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 8px 12px; border-bottom: 1.5px solid var(--hairline);
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAF9F5; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field-input, select.field-input, textarea.field-input {
  width: 100%; border: 1px solid var(--hairline); border-radius: 6px; padding: 9px 11px;
  font-size: 13.5px; background: #fff; color: var(--text); outline: none;
}
.field-input:focus { border-color: var(--brass); }
textarea.field-input { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; border: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-light); }
.btn-brass { background: var(--brass); color: #fff; }
.btn-secondary { background: transparent; border: 1px solid var(--hairline); color: var(--text); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.login-box { background: var(--ivory); border-radius: 10px; padding: 38px 36px; width: 360px; max-width: 90%; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo-img { max-width: 72px; max-height: 72px; object-fit: contain; margin-bottom: 10px; }
.login-title { font-family: 'Source Serif 4', serif; font-size: 22px; font-weight: 700; color: var(--ink); }
.login-tagline { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.login-box .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }

/* ---- Task detail / kanban-ish list ---- */
.task-card { background: var(--card); border: 1px solid var(--hairline); border-radius: 8px; padding: 16px 18px; margin-bottom: 12px; }
.task-title { font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.task-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.task-meta .overdue { color: var(--danger); font-weight: 600; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.pill { border: 1px solid var(--hairline); border-radius: 20px; padding: 6px 13px; font-size: 12.5px; font-weight: 500; color: var(--text); background: transparent; }
.pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; }
  .brand-block { border-bottom: none; border-right: 1px solid rgba(255,255,255,0.08); }
  .nav-links { display: flex; padding: 8px; }
  .nav-footer { display: none; }
  .content { padding: 20px 16px; }
  .field-row { grid-template-columns: 1fr; }
}
