:root {
    --ink: #17201d;
    --muted: #68736f;
    --paper: #f7f5ef;
    --panel: #ffffff;
    --line: #d9ded8;
    --teal: #147c72;
    --amber: #d6972f;
    --coral: #c85d4a;
    --blue: #315c9b;
    --green: #4a8f47;
    --charcoal: #20302d;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, Helvetica, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--charcoal); color: #fff; padding: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { align-items: center; display: flex; gap: 10px; font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.brand span { align-items: center; background: var(--amber); border-radius: 8px; color: var(--ink); display: inline-flex; height: 36px; justify-content: center; width: 36px; }
.tenant { color: #b8c4c0; font-size: 13px; margin: 0 0 22px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { border-radius: 8px; color: #dfe7e3; padding: 11px 12px; }
.sidebar nav a.active, .sidebar nav a:hover { background: rgba(255,255,255,.12); color: white; }
.main { padding: 26px; min-width: 0; }
.topbar { align-items: center; display: flex; justify-content: space-between; gap: 18px; margin: 0 0 24px; }
.topbar p { color: var(--teal); font-size: 12px; font-weight: 800; margin: 0 0 5px; text-transform: uppercase; }
h1 { font-size: 34px; margin: 0; }
h2 { margin: 0 0 14px; }
h3 { margin: 0 0 8px; }
p { line-height: 1.55; }
.user-chip { align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 12px; padding: 10px 12px; }
.user-chip span { background: #e9eee7; border-radius: 999px; color: var(--teal); font-size: 12px; font-weight: 800; padding: 5px 8px; text-transform: uppercase; }
.user-chip a { color: var(--coral); font-weight: 800; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel, .metric, .table-wrap, .form-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 38px rgba(32,48,45,.08); padding: 18px; }
.metric strong { display: block; font-size: 32px; margin-bottom: 4px; }
.metric span, .muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.btn, button { background: var(--teal); border: 0; border-radius: 8px; color: white; cursor: pointer; display: inline-flex; font-weight: 800; min-height: 40px; padding: 0 14px; align-items: center; }
.btn.secondary { background: #edf1ec; color: var(--ink); }
.btn.danger, button.danger { background: var(--coral); }
.flash { border-radius: 8px; font-weight: 700; margin-bottom: 16px; padding: 12px 14px; }
.flash.success { background: #dff0df; color: #2d672c; }
.flash.error { background: #f7ded8; color: #913927; }

table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.badge { border-radius: 999px; display: inline-block; font-size: 12px; font-weight: 800; padding: 5px 9px; }
.badge.low, .badge.approved { background: #dff0df; color: #2d672c; }
.badge.medium, .badge.pending { background: #f7ead0; color: #805315; }
.badge.high, .badge.rejected { background: #f7ded8; color: #913927; }
.badge.stage { background: #e8edf5; color: var(--blue); }

label { color: #3d4744; display: grid; font-size: 13px; font-weight: 800; gap: 7px; }
input, select, textarea { background: #fbfcf9; border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 10px 12px; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.filters { align-items: end; display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 14px; }

.login-body { align-items: center; background: linear-gradient(135deg, #eff4ef, #fbf8ef); display: flex; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 20px 70px rgba(32,48,45,.16); max-width: 430px; padding: 28px; width: 100%; }
.login-card .brand { color: var(--ink); }
.login-card form { display: grid; gap: 14px; }
.login-card button { width: 100%; justify-content: center; }

.calendar { display: grid; gap: 10px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 130px; padding: 12px; }
.day strong { display: block; font-size: 24px; margin-bottom: 12px; }
.list { display: grid; gap: 10px; }
.list-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.timeline { border-left: 3px solid var(--line); display: grid; gap: 14px; padding-left: 14px; }

@media (max-width: 950px) {
    .app-body { grid-template-columns: 1fr; }
    .sidebar { height: auto; position: static; }
    .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.two, .grid.three, .grid.four, .form-grid, .filters, .calendar { grid-template-columns: 1fr; }
    .topbar, .user-chip { align-items: flex-start; flex-direction: column; }
}
