:root {
  --nf-bg: #f4f6f8;
  --nf-surface: #ffffff;
  --nf-border: #dfe5ec;
  --nf-border-strong: #c6d0dc;
  --nf-text: #1e293b;
  --nf-muted: #64748b;
  --nf-primary: #246bfe;
  --nf-primary-dark: #174ea6;
  --nf-success: #16855b;
  --nf-warning: #b26b00;
  --nf-danger: #be123c;
  --nf-info: #0f766e;
  --nf-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  background: var(--nf-bg);
  color: var(--nf-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.5;
  margin: 0;
  min-height: 100%;
}

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

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

code {
  background: #eef2f7;
  border-radius: 6px;
  color: #334155;
  padding: 2px 6px;
}

.nf-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.nf-sidebar {
  background: var(--nf-surface);
  border-right: 1px solid var(--nf-border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 22px 18px;
  position: sticky;
  top: 0;
}

.nf-brand {
  align-items: center;
  color: var(--nf-text);
  display: flex;
  gap: 12px;
  min-height: 48px;
  text-decoration: none;
}

.nf-brand:hover {
  text-decoration: none;
}

.nf-brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #246bfe, #0f766e);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 44px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.nf-brand strong,
.nf-auth-brand strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
}

.nf-brand small,
.nf-auth-brand small {
  color: var(--nf-muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.nf-nav {
  display: grid;
  gap: 6px;
}

.nf-nav-label {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  margin: 16px 10px 6px;
  text-transform: uppercase;
}

.nf-nav-link {
  align-items: center;
  border-radius: 8px;
  color: #334155;
  display: flex;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  text-decoration: none;
}

.nf-nav-link:hover,
.nf-nav-link.active {
  background: #edf4ff;
  color: var(--nf-primary-dark);
  text-decoration: none;
}

.nf-nav-icon {
  align-items: center;
  background: #eef2f7;
  border-radius: 8px;
  color: #475569;
  display: inline-flex;
  flex: 0 0 30px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.nf-main {
  min-width: 0;
  padding: 0 28px 42px;
}

.nf-topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 92px;
}

.nf-topbar h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

.nf-topbar p {
  color: var(--nf-muted);
  margin: 4px 0 0;
}

.nf-user-menu,
.nf-record-actions,
.nf-actions,
.nf-inline-actions,
.nf-filter-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.nf-user-pill {
  background: var(--nf-surface);
  border: 1px solid var(--nf-border);
  border-radius: 999px;
  color: #334155;
  font-weight: 700;
  min-height: 34px;
  padding: 6px 14px;
}

.nf-content {
  display: grid;
  gap: 18px;
}

.nf-panel,
.nf-stat,
.nf-record-header {
  background: var(--nf-surface);
  border: 1px solid var(--nf-border);
  border-radius: 8px;
  box-shadow: var(--nf-shadow);
}

.nf-panel {
  padding: 20px;
}

.nf-panel-header,
.nf-record-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.nf-panel-header {
  margin-bottom: 16px;
}

.nf-panel h2,
.nf-record-header h2 {
  font-size: 17px;
  line-height: 1.3;
  margin: 0;
}

.nf-panel p,
.nf-record-header p,
.nf-panel-header p {
  color: var(--nf-muted);
  margin: 4px 0 0;
}

.nf-record-header {
  padding: 20px;
}

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

.nf-stat {
  min-height: 110px;
  padding: 18px;
}

.nf-stat span {
  color: var(--nf-muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.nf-stat strong {
  display: block;
  font-size: 32px;
  line-height: 1.15;
  margin-top: 14px;
}

.nf-grid {
  display: grid;
  gap: 18px;
}

.nf-grid.two {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
}

.nf-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nf-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nf-grid.detail {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.nf-side-stack {
  display: grid;
  gap: 18px;
}

.nf-table-wrap {
  overflow-x: auto;
}

.nf-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.nf-table th {
  border-bottom: 1px solid var(--nf-border);
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  padding: 12px 10px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.nf-table td {
  border-bottom: 1px solid #edf2f7;
  color: #334155;
  padding: 13px 10px;
  vertical-align: middle;
}

.nf-table-actions {
  text-align: right;
  width: 52px;
}

.nf-empty {
  color: var(--nf-muted);
  padding: 16px 0;
  text-align: center;
}

.nf-badge {
  background: #eef2f7;
  border-radius: 999px;
  color: #475569;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  min-height: 26px;
  padding: 7px 10px;
  white-space: nowrap;
}

.nf-status-approved,
.nf-status-reconciled,
.nf-status-paid {
  background: #e8f8f1;
  color: var(--nf-success);
}

.nf-status-submitted,
.nf-status-funded,
.nf-status-partially_approved {
  background: #fff4df;
  color: var(--nf-warning);
}

.nf-status-rejected,
.nf-status-cancelled {
  background: #ffe8ee;
  color: var(--nf-danger);
}

.nf-button,
.nf-icon-button {
  align-items: center;
  border: 1px solid var(--nf-border-strong);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  text-decoration: none;
}

.nf-button {
  background: #fff;
  color: #334155;
  min-height: 38px;
  padding: 8px 14px;
}

.nf-button:hover,
.nf-icon-button:hover {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  text-decoration: none;
}

.nf-button.primary {
  background: var(--nf-primary);
  border-color: var(--nf-primary);
  color: #fff;
}

.nf-button.danger {
  background: var(--nf-danger);
  border-color: var(--nf-danger);
  color: #fff;
}

.nf-icon-button {
  background: #fff;
  color: #334155;
  height: 34px;
  padding: 0;
  width: 34px;
}

.nf-fab {
  align-items: center;
  background: var(--nf-primary);
  border-radius: 50%;
  bottom: 28px;
  box-shadow: 0 18px 36px rgba(36, 107, 254, 0.28);
  color: #fff;
  display: inline-flex;
  font-size: 28px;
  font-weight: 700;
  height: 54px;
  justify-content: center;
  position: fixed;
  right: 28px;
  text-decoration: none;
  width: 54px;
}

.nf-fab:hover {
  color: #fff;
  text-decoration: none;
}

.nf-filter-bar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(240px, 1.2fr) 220px 280px auto;
}

label,
.nf-field label,
.nf-mini-form label {
  color: #64748b;
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-control,
.nf-auth-form input,
.nf-field input,
.nf-field select,
.nf-field textarea,
.nf-mini-form input,
.nf-mini-form select,
.nf-mini-form textarea {
  background: #fff;
  border: 1px solid var(--nf-border-strong);
  border-radius: 8px;
  color: #1e293b;
  min-height: 40px;
  padding: 9px 11px;
  width: 100%;
}

textarea.form-control,
.nf-field textarea,
.nf-mini-form textarea {
  min-height: 96px;
  resize: vertical;
}

.nf-field ul,
.nf-mini-form ul,
.errorlist {
  color: var(--nf-danger);
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.nf-form-grid {
  display: grid;
  gap: 22px;
}

.nf-form-section {
  display: grid;
  gap: 14px;
}

.nf-definition-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.nf-definition-grid div {
  border-bottom: 1px solid #edf2f7;
  min-height: 58px;
  padding: 0 0 10px;
}

.nf-definition-grid .wide {
  grid-column: 1 / -1;
}

.nf-definition-grid dt {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nf-definition-grid dd {
  margin: 4px 0 0;
}

.nf-mini-form {
  display: grid;
  gap: 10px;
}

.nf-mini-form p {
  margin: 0;
}

.nf-source-list,
.nf-timeline,
.nf-attachments {
  display: grid;
  gap: 10px;
}

.nf-source-row,
.nf-timeline-item,
.nf-attachments a {
  background: #f8fafc;
  border: 1px solid #e7edf4;
  border-radius: 8px;
  padding: 12px;
}

.nf-source-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.nf-timeline.compact .nf-timeline-item {
  display: grid;
  gap: 4px;
}

.nf-timeline-item header {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.nf-timeline-item span,
.nf-attachments small {
  color: var(--nf-muted);
  display: block;
  font-size: 12px;
}

.nf-timeline-item p {
  margin: 8px 0 0;
}

.nf-chatter {
  margin-top: 4px;
}

.nf-chatter-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 320px;
  margin-bottom: 18px;
}

.nf-attachments {
  border-top: 1px solid var(--nf-border);
  margin-top: 18px;
  padding-top: 18px;
}

.nf-attachments a {
  color: var(--nf-text);
}

.nf-messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.nf-message {
  background: #eef7ff;
  border: 1px solid #b9dcff;
  border-left: 6px solid var(--nf-primary);
  border-radius: 8px;
  color: #174ea6;
  padding: 12px 14px;
}

.nf-message.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  border-left-color: var(--nf-success);
  color: #166534;
}

.nf-message.error {
  background: #fff1f2;
  border-color: #fecdd3;
  border-left-color: var(--nf-danger);
  color: #9f1239;
}

.nf-message.warning {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: var(--nf-warning);
  color: #92400e;
}

.nf-auth-body {
  background: #eef2f7;
}

.nf-auth {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.nf-auth-panel {
  background: #fff;
  border: 1px solid var(--nf-border);
  border-radius: 8px;
  box-shadow: var(--nf-shadow);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.nf-auth-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.nf-auth-form {
  display: grid;
  gap: 12px;
}

.nf-auth-form h1 {
  font-size: 22px;
  margin: 0 0 8px;
}

@media (max-width: 1100px) {
  .nf-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .nf-sidebar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .nf-brand span:last-child,
  .nf-nav-link span:last-child,
  .nf-nav-label {
    display: none;
  }

  .nf-brand,
  .nf-nav-link {
    justify-content: center;
  }

  .nf-grid.two,
  .nf-grid.detail,
  .nf-chatter-grid {
    grid-template-columns: 1fr;
  }

  .nf-stats-grid,
  .nf-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nf-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .nf-shell {
    display: block;
  }

  .nf-sidebar {
    min-height: auto;
    position: static;
  }

  .nf-main {
    padding: 0 14px 34px;
  }

  .nf-topbar,
  .nf-panel-header,
  .nf-record-header {
    align-items: stretch;
    flex-direction: column;
  }

  .nf-stats-grid,
  .nf-grid.three,
  .nf-grid.four,
  .nf-filter-bar,
  .nf-definition-grid {
    grid-template-columns: 1fr;
  }

  .nf-filter-actions,
  .nf-record-actions {
    justify-content: flex-start;
  }
}
