:root {
  --bg-a: #eef4f8;
  --bg-b: #f8fbfd;
  --ink: #1f2e3a;
  --muted: #6a7b89;
  --line: #d8e2ea;
  --card: #ffffff;
  --side-a: #16344f;
  --side-b: #204a6a;
  --side-text: #e5eef6;
  --side-muted: #afc4d6;
  --sidebar-w: 258px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.app-body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 8%, #dcecf6 0%, transparent 26%),
    radial-gradient(circle at 10% 25%, #e5f2e9 0%, transparent 22%),
    linear-gradient(180deg, var(--bg-a), var(--bg-b));
}

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

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 1rem 0.85rem;
  background: linear-gradient(180deg, var(--side-a), var(--side-b));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1040;
}

.sidebar-brand {
  display: block;
  text-decoration: none;
  margin-bottom: 1rem;
}

.sidebar-brand .brand-main {
  display: block;
  color: #ffffff;
  font-size: 1.17rem;
  font-weight: 800;
  line-height: 1.2;
}

.sidebar-brand .brand-sub {
  display: block;
  color: var(--side-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.18rem;
}

.sidebar-user {
  margin-bottom: 0.9rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user .name {
  color: var(--side-text);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
}

.sidebar-user .role {
  color: var(--side-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.7rem;
  margin-top: 0.16rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
}

.sidebar-nav a,
.sidebar-logout {
  text-decoration: none;
  color: var(--side-text);
  padding: 0.56rem 0.64rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.sidebar-nav a i,
.sidebar-logout i {
  font-size: 0.95rem;
  width: 1.1rem;
  text-align: center;
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.sidebar-nav a.active {
  box-shadow: inset 2px 0 0 #f4a259;
}

.sidebar-logout {
  margin-top: 0.95rem;
  color: #ffd6d6;
}

.app-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
}

.app-main {
  padding: 1rem 1.1rem 1.25rem;
  min-width: 0;
}

.app-mobile-topbar {
  display: none;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
}

.page-hero {
  background: linear-gradient(130deg, #ffffff, #f4f8fb);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem 1.1rem;
  margin-bottom: 1rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(18, 48, 70, 0.07);
  background: var(--card);
}

.card-header {
  background: #f8fbfd;
  border-bottom: 1px solid var(--line);
}

.table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4f6071;
}

.metric-card .metric-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.metric-card .metric-value {
  font-size: 1.45rem;
  font-weight: 800;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: 0.28rem 0.56rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-soft.overdue {
  background: #ffe8e8;
  color: #a63131;
}

.badge-soft.ok {
  background: #e8f8ef;
  color: #196342;
}

.app-overlay {
  display: none;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    width: min(84vw, 300px);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 28, 41, 0.45);
    z-index: 1030;
  }

  .app-content {
    margin-left: 0;
    width: 100%;
  }

  .app-mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1020;
  }

  .mobile-title {
    font-weight: 800;
    color: #294258;
    letter-spacing: 0.01em;
  }

  .app-main {
    padding: 0.85rem 0.85rem 1.15rem;
  }
}
