@import url("https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&display=swap");

:root {
  --bg: #f2f5fb;
  --ink: #1b2b45;
  --muted: #7c8aa5;
  --card: #ffffff;
  --line: #e6edf7;
  --blue: #2f6fb0;
  --blue-dark: #2a5e98;
  --blue-soft: #eaf2ff;
  --pending: #ffb400;
  --green: #3cc48e;
  --shadow: 0 10px 30px rgba(18, 38, 63, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #f9fbff, var(--bg));
  color: var(--ink);
}

body.nav-open {
  overflow: hidden;
}

.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: block;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-docs {
  margin-top: 20px;
}

.page-profile {
  margin-top: 20px;
}

.page-profile.active {
  display: grid;
  gap: 20px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #2e5f97 0%, #2a4a7a 100%);
  color: #fff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.brand {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-mark {
  color: #d9ecff;
}

.brand-sub {
  color: #ffffff;
  font-weight: 400;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: -20px;
}

.menu-item {
  background: transparent;
  border: 1px solid transparent;
  color: #d8e6fb;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-item:hover,
.menu-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.menu-item i {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
}

.menu-item:hover i,
.menu-item.active i {
  color: #fff;
}

.sidebar-card {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.12);
  padding: 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.sidebar-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.content {
  padding: 24px 28px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.crumb-small {
  font-size: 12px;
  color: var(--muted);
}

.crumb-title {
  font-size: 20px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 10px;
}

.search input {
  border: none;
  outline: none;
  font-size: 12px;
  width: 160px;
}

.icon-btn {
  border: none;
  background: var(--card);
  border-radius: 10px;
  padding: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--blue-dark);
}

.icon-btn i {
  font-size: 14px;
}

.nav-toggle {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 38, 63, 0.4);
  backdrop-filter: blur(1px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 3;
}

.sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px 0;
}

.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.stat-icon {
  background: var(--blue-soft);
  color: var(--blue);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.stat-icon i {
  font-size: 16px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.title-text {
  font-size: 16px;
}

.status-pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: #eef2f8;
  color: #5c6d8b;
}

.status-pill.pending {
  background: #fff3d6;
  color: #c57f00;
}

.tabs {
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 6px;
  border-radius: 12px;
}

.tabs.small {
  background: transparent;
  padding: 0;
}

.tab {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.tab.active {
  background: var(--blue);
  color: #fff;
}

.date-filter {
  position: relative;
}

.date-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  min-width: 240px;
  text-align: left;
  box-shadow: var(--shadow);
}

.date-filter-toggle:hover {
  border-color: #cdd8ea;
  box-shadow: 0 8px 18px rgba(18, 38, 63, 0.08);
}

.date-filter-label {
  white-space: nowrap;
}

.date-filter-toggle i {
  color: var(--muted);
  font-size: 14px;
  transition: transform 0.18s ease;
}

.date-filter.open .date-filter-toggle i {
  transform: rotate(180deg);
}

.date-filter-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(18, 38, 63, 0.14);
  padding: 12px;
  width: 320px;
  display: none;
  z-index: 5;
}

.date-filter.open .date-filter-popover {
  display: grid;
  gap: 12px;
}

.date-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.date-filter-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.date-filter-field span {
  font-weight: 600;
  color: var(--muted);
}

.date-filter-field input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
  background: #f9fbff;
}

.date-filter-field input:focus-visible {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.date-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  align-items: center;
}

.table > .row:last-of-type {
  border-bottom: none;
}

.row.hidden {
  display: none;
}

.table-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  background: #f7f9fd;
}

.row.header {
  background: #f7f9fd;
  font-weight: 600;
  color: #5c6d8b;
}

.route {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tag {
  background: #eef7f1;
  color: #2f9e68;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
}

.status {
  color: #c57f00;
  font-weight: 600;
}

.docs {
  display: flex;
  gap: 8px;
  color: #6d7f9c;
}

.docs i {
  font-size: 14px;
}

.subcard {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.subcard-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.row.muted {
  color: #c7d0e0;
}

.placeholder {
  height: 12px;
  background: #edf1f8;
  border-radius: 6px;
}

.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.permit {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.permit-row {
  background: #f7f9fd;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1.8fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.permit-title {
  font-weight: 600;
  font-size: 12px;
}

.permit-meta {
  font-size: 11px;
  color: var(--muted);
}

.permit-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.permit-status.pending {
  background: #fff3d6;
  color: #c57f00;
}

.permit-status.approved {
  background: #e7f6ef;
  color: #2f9e68;
}

.doc-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.doc-item {
  background: #f7f9fd;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.doc-item.downloadable {
  grid-template-columns: 1fr auto;
}

.doc-item .doc-name {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
  transition: color 0.15s ease;
}

.doc-item .doc-name:visited {
  color: inherit;
}

.doc-item .doc-name:hover,
.doc-item .doc-name:focus-visible {
  color: var(--blue);
  text-decoration: none;
}

.download-btn {
  padding: 6px 12px;
  font-size: 11px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 12px;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-top: 10px;
}

.profile-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.profile-field span {
  font-weight: 600;
  color: var(--ink);
}

.profile-field input,
.profile-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f9fbff;
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
}

.profile-field textarea {
  min-height: 96px;
}

.profile-field.wide {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-status {
  font-size: 12px;
  color: var(--muted);
}

.profile-status.success {
  color: var(--green);
}

.profile-status.error {
  color: #e06262;
}

.doc-count {
  background: #e8eef8;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
  color: #395174;
}

.doc-status {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.doc-status.ok {
  background: #e7f6ef;
  color: #2f9e68;
}

.doc-status.warn {
  background: #ffecec;
  color: #e06262;
}

.doc-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fd;
  font-size: 13px;
}

.btn {
  background: var(--blue);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.btn.full {
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
}

.btn.ghost {
  background: #f5f7fd;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  border-color: #cdd8ea;
}

.login-body {
  min-height: 100vh;
  background: linear-gradient(120deg, #e9f2ff 0%, #f7f9fd 45%, #ffffff 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.login-panel {
  padding: 80px 80px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
}

.login-tagline {
  color: var(--muted);
  margin-bottom: 30px;
}

.login-card {
  background: #ffffff;
  padding: 28px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-width: 420px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.input-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  background: #f9fbff;
}

.input-wrap i {
  color: var(--blue);
}

.input-wrap input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}

.login-foot {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.login-foot a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.login-error {
  color: #e06262;
  font-weight: 600;
}

.login-hero {
  background: linear-gradient(150deg, #2f6fb0, #1f3f6b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.hero-card {
  max-width: 360px;
  display: grid;
  gap: 14px;
}

.hero-title {
  font-size: 26px;
  font-weight: 600;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.hero-value {
  font-size: 22px;
  font-weight: 600;
}

.hero-label {
  font-size: 12px;
  opacity: 0.8;
}

@media (max-width: 1024px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-hero {
    display: none;
  }
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 4;
    overflow-y: auto;
  }

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

  .menu,
  .sidebar-card {
    display: flex;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(120deg, #e9f2ff 0%, #f7f9fd 45%, #ffffff 100%);
    padding: 10px 0;
  }

  .content {
    padding: 0 16px 28px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1.4fr 1fr;
    grid-auto-rows: auto;
  }

  .row.header {
    display: none;
  }

  .doc-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .login-panel {
    padding: 60px 24px;
  }
}

