/* Procurement Monitoring System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #a51c30;
  --primary-light: #c4233a;
  --primary-dark: #8a1728;
  --accent: #a51c30;
  --accent-hover: #8a1728;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --danger: #a51c30;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --light-bg: #f4f5f7;
  --sidebar-bg: #eef0f3;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --h1: 1.35rem;
  --h2: 1.05rem;
  --body: 0.9375rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: var(--body);
  background: var(--light-bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

h1 {
  font-size: var(--h1);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--h2);
  font-weight: 600;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* App shell — sidebar + main */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1.15rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.sidebar-app-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar-app-full {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.sidebar-office {
  padding: 0.9rem 1.15rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.sidebar-office-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.sidebar-office-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.sidebar-user-name {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-office-label-secondary {
  display: block;
  margin-top: 0.65rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.65rem;
  flex: 1;
  gap: 0.2rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  color: #374151;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.sidebar-link:hover {
  background: rgba(165, 28, 48, 0.08);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(165, 28, 48, 0.25);
}

.sidebar-nav-footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

.sidebar-cta {
  margin: 0.5rem 0.35rem 0.75rem;
}

.sidebar-cta .btn {
  width: 100%;
}

.sidebar-link-logout {
  margin-top: auto;
  color: var(--muted);
  font-weight: 500;
}

.sidebar-link-logout:hover {
  background: rgba(165, 28, 48, 0.08);
  color: var(--primary);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main > main {
  flex: 1;
}

/* Top navbar */
.top-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.top-navbar-left {
  min-width: 0;
  flex: 1;
}

.top-navbar-title {
  font-size: var(--h1);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.top-navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--light-bg);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  position: relative;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: #f3c5cb;
  background: #fff;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.notif-wrap {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notif-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  width: 340px;
  max-width: min(340px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 80;
  overflow: hidden;
}

.notif-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.notif-clear-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.2rem;
}

.notif-clear-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.notif-clear-btn:disabled {
  color: var(--muted);
  cursor: default;
}

.notif-menu-list {
  list-style: none;
  margin: 0;
  max-height: 360px;
  overflow-y: auto;
}

.notif-menu-list > li.text-muted {
  padding: 0.85rem;
  font-size: 0.85rem;
}

.notif-item a {
  display: block;
  padding: 0.7rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.notif-item:last-child a {
  border-bottom: none;
}

.notif-item a:hover {
  background: var(--light-bg);
  text-decoration: none;
}

.notif-item.unread a {
  background: #fdf2f4;
}

.notif-item a strong {
  display: block;
  font-size: 0.82rem;
}

.notif-item a span {
  display: block;
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 0.15rem;
}

.notif-item a .meta {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 0.25rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.65rem 0.25rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.user-chip-meta {
  text-align: left;
  line-height: 1.2;
}

.user-chip-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.user-chip-name small,
.user-chip-office small {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
}

.user-chip-office {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
}

.user-menu-wrap {
  position: relative;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 0.35rem;
  z-index: 80;
}

.user-menu a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.user-menu a:hover {
  background: var(--light-bg);
  text-decoration: none;
  color: var(--primary);
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0.4rem;
}

.top-navbar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.top-navbar-search input {
  width: 220px;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--light-bg);
}

.top-navbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(165, 28, 48, 0.15);
  background: #fff;
}

.top-navbar-search-btn {
  white-space: nowrap;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(440px, calc(100vw - 2rem));
  max-height: 360px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 80;
}

.global-search-results a,
.global-search-results p {
  display: block;
  padding: 0.75rem 1rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.global-search-results a:hover,
.global-search-results a:focus-visible {
  background: var(--light-bg);
}

@media (max-width: 600px) {
  .top-navbar {
    padding: 0.75rem 1rem;
  }

  .top-navbar-search {
    width: 100%;
    margin-left: 0;
  }

  .top-navbar-search input {
    flex: 1;
    width: auto;
  }
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

.container-wide {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

.details-page-layout,
.details-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}

.fund-dashboard-card {
  position: sticky;
  top: 5rem;
}

.fund-dashboard-card .section-heading-row {
  align-items: flex-start;
}

.fund-dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.fund-dashboard-summary {
  margin: 0.9rem 0 1rem;
}

.fund-dashboard-remaining span,
.fund-progress-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.fund-dashboard-remaining strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.fund-progress-track {
  height: 0.65rem;
  margin-top: 0.8rem;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 999px;
}

.fund-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: inherit;
  transition: width 0.2s ease, background 0.2s ease;
}

.fund-progress-fill.over {
  background: var(--danger);
}

.fund-dashboard-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.fund-dashboard-row span {
  min-width: 0;
}

.fund-dashboard-row small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.text-danger,
.status-danger {
  color: var(--danger) !important;
}

@media (max-width: 850px) {
  .details-page-layout,
  .details-top-grid {
    grid-template-columns: 1fr;
  }

  .fund-dashboard-card {
    position: static;
  }
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.notification-list {
  list-style: none;
  margin: 0;
}

.notification-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.notification-list li:last-child {
  border-bottom: none;
}

.notification-list .meta {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.notif-filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

.notif-filter-row select {
  min-width: 0;
  flex: 1;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.section-heading-row,
.signatory-row,
.signatory-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-heading-row {
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.section-heading-row > div {
  min-width: 0;
}

.section-heading-row .text-muted {
  margin-top: 0.25rem;
}

.signatory-summary {
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--light-bg);
  border: 1px solid var(--border);
}

.signatory-summary > div {
  flex: 1 1 130px;
}

.signatory-gate-message {
  margin: 0 0 0.75rem;
  color: var(--primary);
  font-size: 0.8rem;
}

.signatory-gate-message.ready {
  color: var(--success);
}

.signatory-summary .label,
.signatory-info span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.signatory-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.signatory-office-group {
  list-style: none;
  padding-top: 0.5rem;
}

.signatory-office-group h3 {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.signatory-office-group ol {
  list-style: none;
}

.signatory-row {
  min-height: 54px;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.signatory-order {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.signatory-info {
  min-width: 150px;
  flex: 1;
}

.signatory-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

.signatory-form {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.signatory-history {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.signatory-history summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.signatory-history ul {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding-left: 1.1rem;
}

.new-signatory-rows {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.new-signatory-rows > li {
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--light-bg);
}

.new-signatory-rows > li strong,
.new-signatory-rows > li small {
  display: block;
}

.new-signatory-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1.2fr auto;
  align-items: end;
  gap: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--light-bg);
}

.new-signatory-row .form-group {
  margin-bottom: 0;
}

.new-signatory-row .btn {
  white-space: nowrap;
}

@media (max-width: 800px) {
  .new-signatory-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .new-signatory-row .btn {
    justify-self: start;
  }
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.amount-box {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-top: 1rem;
}

.amount-box .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.amount-box .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
  }

  .sidebar-link-logout {
    margin-top: 0;
  }

  .top-navbar-search input {
    width: 160px;
  }

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

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .multi-step-progress {
    flex-direction: column;
    gap: 1rem;
  }

  .multi-step-progress::before {
    display: none;
  }

  .progress-step {
    flex-direction: row;
    justify-content: flex-start;
    gap: 1rem;
  }

  .progress-step-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .progress-step-label {
    text-align: left;
    max-width: none;
  }

  .tracking-overview {
    gap: 0.75rem;
  }

  .tracking-step {
    padding: 0.75rem;
  }

  .step-icon {
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
  }
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: var(--h2);
  margin-bottom: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(15, 23, 42, 0.42), rgba(15, 23, 42, 0.42)),
    url('../../batstate.jpg') center / cover no-repeat fixed;
  padding: 1rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(4px);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.login-logo img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  display: block;
}

.login-card h1 {
  font-size: 1.5rem;
  color: var(--primary);
  text-align: center;
  margin-bottom: 0.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-card .notice {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(165, 28, 48, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--light-bg);
  border-color: #d1d5db;
}

a.btn:hover {
  text-decoration: none;
}

.btn-block {
  width: 100%;
  text-align: center;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-danger:hover:not(:disabled) {
  background: #fecaca;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-tabs {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.page-tab {
  padding: 0.65rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.page-tab:hover {
  color: var(--text);
}

.page-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  margin-top: 0;
}

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

.panel-header h2 {
  margin: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }

  .analytics-charts-row {
    grid-template-columns: 1fr;
  }

  .chart-card-wide {
    grid-column: 1;
  }

  .stat-box-large {
    grid-column: 1;
  }

  .stat-box-large .number {
    font-size: 2rem;
  }
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.popup-dialog {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  overflow: visible;
}

.popup-dialog:not([open]) {
  display: none !important;
}

.popup-dialog[open] {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1.5rem;
  border: none;
  background: transparent;
}

.popup-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.popup-window.card {
  width: min(520px, calc(100vw - 3rem));
  max-height: min(calc(100vh - 3rem), 680px);
  margin: 0;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: popupIn 0.2s ease-out;
}

.popup-window .panel-header {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.popup-window .panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary);
}

.popup-window form {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

@keyframes popupIn {
  from {
    transform: scale(0.97) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.popup-close {
  border: none;
  background: var(--border);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.popup-close:hover {
  background: #cbd5e1;
  color: var(--text);
}

.modal-card {
  width: 100%;
  max-width: 480px;
  margin-bottom: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

body.modal-open {
  overflow: hidden;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--light-bg);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(165, 28, 48, 0.15);
}

.search-bar button:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 480px) {
  .search-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-bar .btn {
    width: 100%;
  }
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  text-align: left;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-box .number {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.stat-box .label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-box-large {
  grid-column: span 1;
}

.stat-box-large .number {
  font-size: 2.5rem;
  color: var(--primary);
}

@media (min-width: 768px) {
  .stat-box-large {
    grid-column: span 1;
  }
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.office-request-toolbar {
  container-type: inline-size;
  margin-bottom: 1.25rem;
}

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

.request-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.office-request-toolbar-header strong,
.office-request-toolbar-header button {
  white-space: nowrap;
}

.office-request-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(210px, 1.2fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(250px, 1.3fr);
  gap: 1rem;
  align-items: end;
}

.request-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.office-request-filters.office-request-filters-compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.request-filter-field label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.request-filter-field input,
.request-filter-field select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.request-filter-field input:focus,
.request-filter-field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@container (max-width: 1080px) {
  .office-request-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .request-filter-sort {
    grid-column: 1 / -1;
  }
}

@container (max-width: 540px) {
  .office-request-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}

.request-list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.request-list-toolbar strong {
  margin-right: auto;
}

.request-list-toolbar label {
  color: var(--muted);
  font-size: 0.8rem;
}

.request-list-toolbar select {
  min-width: 170px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.request-list-toolbar input {
  width: 125px;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.request-list-toolbar input[type='search'] {
  width: 180px;
}

.request-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.request-pagination span {
  min-width: 90px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.request-pagination button:disabled {
  cursor: default;
  opacity: 0.5;
}

@media (max-width: 600px) {
  .request-list-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .request-list-toolbar strong {
    flex-basis: 100%;
  }

  .request-list-toolbar select {
    flex: 1;
    min-width: 0;
  }

  .request-list-toolbar input,
  .request-list-toolbar input[type='search'] {
    flex: 1;
    width: auto;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f3f4f6;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:hover td {
  background: #f8fafc;
}

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fde8eb;
  color: var(--primary);
}

.status-badge.completed {
  background: #d1fae5;
  color: var(--success);
}

.status-badge.budget {
  background: #fef3c7;
  color: #b45309;
}

.status-badge.procurement {
  background: #fce7f3;
  color: #be185d;
}

.status-badge.accounting {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge.cashier {
  background: #e0e7ff;
  color: #4338ca;
}

.status-badge.pso {
  background: #ede9fe;
  color: #6d28d9;
}

.status-badge.closed {
  background: #e5e7eb;
  color: #4b5563;
}

tr.row-focus td {
  background: #f0f9ff;
}

code {
  font-size: 0.85em;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #334155;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

.timeline-current-location {
  display: grid;
  gap: 0.15rem;
  padding: 0.8rem 1rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--light-bg);
}

.timeline-current-location strong {
  color: var(--primary);
}

.timeline-current-location small {
  color: var(--muted);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.22rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item.signature-event::before {
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item .status {
  font-weight: 600;
  color: var(--primary);
}

.timeline-item .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.timeline-item .note {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  color: var(--text);
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  background: var(--light-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar {
  height: 10px;
  background: var(--primary);
  border-radius: var(--radius);
  transition: width 0.3s ease;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.progress-bar-label .percentage {
  font-weight: 600;
  color: var(--primary);
}

@media (max-width: 600px) {
  .progress-bar {
    height: 8px;
  }

  .progress-bar-label {
    font-size: 0.8rem;
  }
}

/* Multi-step Progress */
.multi-step-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0;
  position: relative;
}

.multi-step-progress::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  position: relative;
  flex: 1;
}

.progress-step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

.progress-step.completed .progress-step-icon {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.progress-step.active .progress-step-icon {
  background: white;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(165, 28, 48, 0.15);
}

.progress-step-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  max-width: 80px;
}

.multi-step-progress.office-stepper .progress-step-label {
  max-width: 100px;
  font-size: 0.78rem;
}

.progress-step-signatures {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.65rem;
  text-align: center;
}

.signatory-stepper {
  margin: 0.5rem 0 1rem;
}

.signatory-stepper h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.signatory-stepper ol {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0 0 0.4rem;
  overflow-x: auto;
  list-style: none;
}

.signatory-progress-step {
  display: flex;
  flex: 1 0 130px;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  max-width: 190px;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--light-bg);
  text-align: center;
  font-size: 0.72rem;
}

.signatory-progress-step strong {
  color: var(--text);
}

.signatory-progress-step > span:not(.signatory-progress-icon) {
  color: var(--muted);
}

.signatory-progress-step small {
  color: var(--muted);
}

.signatory-progress-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-weight: 600;
}

.signatory-progress-step.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(165, 28, 48, 0.1);
}

.signatory-progress-step.active .signatory-progress-icon {
  border-color: var(--primary);
  color: var(--primary);
}

.signatory-progress-step.completed .signatory-progress-icon {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.progress-step.active .progress-step-signatures,
.progress-step.completed .progress-step-signatures {
  color: var(--primary);
}

.office-stepper-location {
  margin: -0.75rem 0 1rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--primary);
  background: var(--light-bg);
  color: var(--text);
  font-size: 0.9rem;
}

.progress-step.completed .progress-step-label,
.progress-step.active .progress-step-label {
  color: var(--primary);
  font-weight: 500;
}

@media (max-width: 600px) {
  .multi-step-progress {
    gap: 0.5rem;
  }

  .progress-step-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .progress-step-label {
    font-size: 0.65rem;
    max-width: 60px;
  }
}

/* Flow diagram */
.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.flow-step {
  padding: 0.35rem 0.75rem;
  background: #f1f5f9;
  border-radius: var(--radius);
  color: var(--muted);
}

.flow-step.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.flow-arrow {
  color: var(--muted);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.alert-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.doc-list {
  list-style: none;
}

.doc-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.detail-item .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}

.detail-item .value {
  font-weight: 500;
}

.role-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.role-option:hover {
  border-color: var(--primary);
  background: #fef2f2;
}

.role-option input {
  width: auto;
}

.role-option.selected {
  border-color: var(--primary);
  background: #fee2e2;
}

.update-section {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 1rem;
}

footer.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  background: var(--light-bg);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* Analytics */
.analytics-date-filter {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
}

.analytics-date-filter .form-group {
  flex: 0 1 230px;
  margin: 0;
}

.analytics-date-filter input[type="date"] {
  min-height: 48px;
  font-size: 1rem;
}

.analytics-filter-btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-inline: 1.25rem;
}

.analytics-filter-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@media (max-width: 640px) {
  .analytics-date-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-date-filter .form-group {
    flex-basis: auto;
  }
}

.analytics-section {
  margin-bottom: 2rem;
}

.analytics-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.analytics-section-header h2 {
  font-size: var(--h2);
  color: var(--text);
  margin: 0;
}

.analytics-type-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-type-badge.descriptive {
  background: #fee2e2;
  color: var(--primary);
}

.analytics-type-badge.diagnostic {
  background: #fef3c7;
  color: #b45309;
}

.analytics-type-badge.predictive {
  background: #e0e7ff;
  color: #4338ca;
}

.analytics-insight {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  max-width: 720px;
}

.analytics-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  margin-bottom: 0;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.stat-hint {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.bottleneck-note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.analytics-list {
  list-style: none;
  margin: 0;
}

.analytics-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.row-at-risk td {
  background: #fef2f2;
}

.risk-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--danger);
  background: #fee2e2;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.25rem;
}

/* Tracking Progress */
.tracking-overview {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tracking-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--light-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tracking-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.step-icon {
  font-size: 0.85rem;
  font-weight: 700;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
}

.step-info {
  flex: 1;
}

.step-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.step-status {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .tracking-step {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .step-icon {
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
  }

  .step-title {
    font-size: 0.9rem;
  }

  .step-status {
    font-size: 0.8rem;
  }
}

.alloc-amount {
  font-weight: 600;
}

.alloc-share-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.alloc-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  min-width: 120px;
}

.alloc-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

@media print {
  .app-sidebar,
  .top-navbar,
  .app-footer,
  .print-hide,
  .update-section,
  .signatory-form,
  #uploadLink,
  .signatory-actions {
    display: none !important;
  }

  .app-layout,
  .app-main {
    display: block;
    background: #fff;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}
