:root {
  --brand-dark: #1b2a41;
  --brand-mid: #2c4257;
  --brand-accent: #e08e28;
  --brand-accent-dark: #c8761a;
  --bg-soft: #f4f6f8;
  --success: #2f8f4e;
  --danger: #c0392b;
  --card-radius: 10px;
}

body {
  background: var(--bg-soft);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #22303f;
}

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

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, var(--brand-dark), var(--brand-mid));
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-brand i { color: var(--brand-accent); font-size: 1.4rem; }

.sidebar-project { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }

.sidebar-nav { list-style: none; padding: 10px 0; margin: 0; flex: 1; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 11px 20px;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav li a.active {
  background: rgba(224,142,40,0.16);
  border-left-color: var(--brand-accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav li a i { width: 18px; text-align: center; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid #e3e8ee;
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }

.role-badge { text-transform: uppercase; font-size: 0.68rem; letter-spacing: .04em; }
.role-admin { background: var(--brand-accent) !important; }
.role-accountant { background: #3a7bd5 !important; }
.role-member { background: #6c757d !important; }
.role-viewer { background: #9aa5b1 !important; }

.content { padding: 26px; flex: 1; }

.kpi-card {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(20,30,40,0.06);
  border-left: 4px solid var(--brand-accent);
  height: 100%;
}
.kpi-card .kpi-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; color: #7a8794; font-weight: 600; }
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--brand-dark); margin-top: 4px; }
.kpi-card.accent-blue { border-left-color: #3a7bd5; }
.kpi-card.accent-green { border-left-color: var(--success); }
.kpi-card.accent-red { border-left-color: var(--danger); }

.panel {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: 0 1px 4px rgba(20,30,40,0.06);
  margin-bottom: 22px;
}
.panel-title {
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 14px;
  font-size: 1rem;
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #7a8794;
  border-bottom-width: 1px;
}

.btn-brand {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #fff;
}
.btn-brand:hover { background: var(--brand-accent-dark); border-color: var(--brand-accent-dark); color: #fff; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-mid));
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.login-card h3 { color: var(--brand-dark); font-weight: 700; }
.sidebar-section-label { padding: 12px 16px 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8b95a7; font-weight: 700; }


/* Responsive navigation and mobile usability */
.topbar-left { display:flex; align-items:center; gap:10px; min-width:0; }
.sidebar-toggle { display:none; border:0; background:transparent; color:var(--brand-dark); font-size:1.2rem; padding:6px 8px; border-radius:6px; }
.sidebar-toggle:hover { background:#eef2f5; }
.sidebar-backdrop { display:none; }
.table-responsive { overflow-x:auto; -webkit-overflow-scrolling:touch; }

@media (max-width: 991.98px) {
  .sidebar { position:fixed; left:0; top:0; bottom:0; height:100vh; z-index:1045; transform:translateX(-100%); transition:transform .2s ease; box-shadow:4px 0 18px rgba(0,0,0,.18); }
  .sidebar.open { transform:translateX(0); }
  .sidebar-backdrop.show { display:block; position:fixed; inset:0; z-index:1040; background:rgba(0,0,0,.45); }
  .sidebar-toggle { display:inline-flex; align-items:center; justify-content:center; }
  .topbar { padding:10px 14px; }
  .topbar-user > span:not(.role-badge) { display:none; }
  .content { padding:16px; }
}

@media (max-width: 575.98px) {
  .content { padding:10px; }
  .topbar-title { font-size:1rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .topbar-user .role-badge { display:none; }
  .panel { padding:14px; margin-bottom:14px; }
  .login-card { width:min(92vw,380px); padding:28px 20px; }
  .btn { min-height:38px; }
  .form-control, .form-select { min-height:40px; }
  .table { font-size:.86rem; }
  .table td, .table th { white-space:nowrap; }
}
