:root {
  --app-bg: #f3f6f8;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafb;
  --app-ink: #17212b;
  --app-muted: #667485;
  --app-border: #dfe6ee;
  --app-primary: #2454a6;
  --app-primary-strong: #183d7c;
  --app-accent: #0f766e;
  --app-warning: #a16207;
  --app-danger: #b42318;
  --app-shadow: 0 14px 36px rgba(31, 42, 55, 0.08);
  --app-radius: 8px;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(36, 84, 166, 0.08), transparent 30rem),
    linear-gradient(180deg, #f8fafc 0%, var(--app-bg) 42%, #eef3f6 100%);
  color: var(--app-ink);
  font-size: 0.95rem;
  letter-spacing: 0;
}

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

a:hover {
  color: var(--app-primary-strong);
}

.app-topbar {
  min-height: 68px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(223, 230, 238, 0.85);
  box-shadow: 0 1px 0 rgba(23, 33, 43, 0.04);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-brand {
  align-items: center;
  display: inline-flex;
  gap: 0.75rem;
  margin-right: 1rem;
  min-width: 0;
}

.app-brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-radius: var(--app-radius);
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  line-height: 1;
  width: 38px;
}

.app-brand-title,
.app-brand-subtitle {
  display: block;
  line-height: 1.05;
}

.app-brand-title {
  color: var(--app-ink);
  font-size: 1rem;
  font-weight: 750;
}

.app-brand-subtitle {
  color: var(--app-muted);
  font-size: 0.76rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.navbar-nav-actions {
  flex-wrap: wrap;
}

.btn {
  border-radius: 7px;
  font-weight: 650;
}

.btn-fixed {
  width: 136px;
}

.btn-primary {
  background: var(--app-primary);
  border-color: var(--app-primary);
  box-shadow: 0 8px 18px rgba(36, 84, 166, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--app-primary-strong);
  border-color: var(--app-primary-strong);
}

.btn-outline-primary {
  border-color: rgba(36, 84, 166, 0.34);
  color: var(--app-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-outline-secondary {
  border-color: var(--app-border);
  color: #465466;
}

.btn-nav {
  background: transparent;
  border: 1px solid transparent;
  color: #465466;
}

.btn-nav:hover,
.btn-nav:focus {
  background: var(--app-surface-soft);
  border-color: var(--app-border);
  color: var(--app-primary);
}

.user-chip {
  align-items: center;
  background: #eef7f6;
  border: 1px solid #cbe7e2;
  border-radius: 999px;
  color: #0f514d;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 31px;
  padding: 0.25rem 0.75rem;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 250px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1580px;
  padding: 1.25rem;
}

.app-sidebar {
  align-self: start;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(223, 230, 238, 0.85);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  padding: 0.9rem;
  position: sticky;
  top: 88px;
}

.sidebar-card {
  background: linear-gradient(135deg, #183d7c, #0f766e);
  border-radius: var(--app-radius);
  color: #fff;
  margin-bottom: 0.75rem;
  padding: 1rem;
}

.sidebar-kicker {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-user {
  font-size: 0.98rem;
  font-weight: 800;
  margin-top: 0.35rem;
}

.sidebar-role {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.25rem;
}

.sidebar-nav a,
.sidebar-action-form button {
  background: transparent;
  border-radius: 7px;
  border: 0;
  color: #475569;
  display: block;
  font-weight: 700;
  padding: 0.72rem 0.8rem;
  text-align: left;
  width: 100%;
}

.sidebar-action-form {
  margin: 0;
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.sidebar-action-form button:hover,
.sidebar-action-form button:focus {
  background: #eef4ff;
  color: var(--app-primary);
}

.app-main {
  min-width: 0;
  padding: 0.1rem 0 2rem;
}

.public-main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 3.25rem 1.25rem;
}

.flash-stack {
  margin-bottom: 1rem;
}

.page-header {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(223, 230, 238, 0.9);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 1.15rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.stat-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  min-height: 116px;
  padding: 1.1rem;
}

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

.stat-value {
  color: var(--app-ink);
  font-size: 1.75rem;
  font-weight: 830;
  line-height: 1;
  margin-top: 0.65rem;
}

.archive-header .page-actions {
  align-items: center;
}

.month-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 430px);
}

.month-switches {
  align-self: start;
}

.month-header-actions {
  align-items: center;
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
}

.archive-switch {
  min-height: 38px;
  min-width: 160px;
}

.archive-switch-small {
  min-width: 104px;
}

.archive-card-grid,
.dashboard-card-grid,
.monthly-doc-grid {
  display: grid;
  gap: 1rem;
}

.archive-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 250px));
}

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

.monthly-doc-grid {
  align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
  justify-content: start;
  row-gap: 1.5rem;
}

.studio-file-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 250px));
}

.archive-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  color: var(--app-ink);
  display: grid;
  gap: 1rem;
  min-height: 172px;
  overflow: hidden;
  padding: 1rem;
  position: relative;
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.archive-card::before {
  background: linear-gradient(90deg, var(--app-primary), var(--app-accent));
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.archive-card:hover {
  border-color: rgba(36, 84, 166, 0.36);
  box-shadow: 0 18px 42px rgba(31, 42, 55, 0.12);
  color: var(--app-ink);
  transform: translateY(-2px);
}

.month-card-date {
  align-items: center;
  background: #eef7f6;
  border: 1px solid #cbe7e2;
  border-radius: var(--app-radius);
  color: #0f514d;
  display: inline-grid;
  height: 68px;
  justify-content: center;
  justify-self: start;
  line-height: 1;
  min-width: 72px;
  padding: 0.5rem 0.7rem;
  text-align: center;
}

.month-card-number {
  color: #0f514d;
  font-size: 1.48rem;
  font-weight: 880;
}

.month-card-year {
  color: #52746f;
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.04em;
  margin-top: 0.18rem;
  text-transform: uppercase;
}

.archive-card-icon {
  background: #eef4ff;
  border-color: #d8e6ff;
  color: var(--app-primary);
}

.archive-card-icon .month-card-number {
  color: var(--app-primary);
}

.archive-card-icon .month-card-year {
  color: #5f73a2;
}

.archive-card-body,
.archive-card-title,
.archive-card-meta,
.archive-card-footer,
.archive-card-action {
  display: block;
}

.archive-card-body {
  align-self: end;
}

.archive-card-title {
  color: var(--app-ink);
  font-size: 1.08rem;
  font-weight: 850;
}

.archive-card-meta {
  color: var(--app-muted);
  font-size: 0.86rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.archive-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.document-grid {
  display: grid;
  gap: 0.85rem;
}

.document-card {
  align-items: center;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: 0 10px 28px rgba(31, 42, 55, 0.06);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.3fr) minmax(180px, 0.9fr) auto;
  padding: 1rem;
}

.document-card-identity {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.document-kind-tag {
  align-items: center;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
  color: #243244;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 850;
  justify-content: center;
  line-height: 1;
  min-height: 32px;
  min-width: 6.35rem;
  padding: 0.45rem 0.7rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.document-kind-tag-payslip,
.document-kind-tag-payslips_company,
.document-kind-tag-payslip_employee {
  background: #e9f7f1;
  border-color: #bfe6d3;
  color: #17633f;
}

.document-kind-tag-f24 {
  background: #eef4ff;
  border-color: #cdddf9;
  color: #244d91;
}

.document-kind-tag-accounting_note {
  background: #fff4db;
  border-color: #f0d28f;
  color: #75510c;
}

.document-period-text {
  color: var(--app-ink);
  font-size: 0.95rem;
  font-weight: 850;
  white-space: nowrap;
}

.document-card-type {
  color: var(--app-primary);
  display: block;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.document-card-title {
  color: var(--app-ink);
  font-size: 0.98rem;
  font-weight: 830;
  line-height: 1.25;
  margin: 0.2rem 0 0;
}

.document-card-meta,
.document-card-file {
  color: var(--app-muted);
  font-size: 0.82rem;
}

.document-card-file {
  min-width: 0;
}

.document-card-file span,
.document-card-file small {
  display: block;
}

.document-card-file span {
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-card-file small {
  color: var(--app-muted);
  margin-top: 0.15rem;
}

.document-card-actions {
  display: flex;
  gap: 0.5rem;
}

.archive-card-footer {
  align-items: center;
  border-top: 1px solid #edf1f5;
  color: var(--app-muted);
  display: flex;
  font-size: 0.78rem;
  gap: 0.5rem;
  justify-content: space-between;
  padding-top: 0.85rem;
}

.archive-card-footer strong {
  color: var(--app-ink);
}

.archive-card-action {
  background: #eef4ff;
  border: 1px solid #d8e6ff;
  border-radius: 7px;
  color: var(--app-primary);
  font-size: 0.8rem;
  font-weight: 850;
  padding: 0.38rem 0.6rem;
  position: absolute;
  right: 1rem;
  top: 1rem;
}

.studio-month-card {
  padding-top: 3rem;
}

.studio-month-card .archive-card-link {
  inset: 0;
  position: absolute;
  z-index: 1;
}

.studio-month-card .month-card-date,
.studio-month-card .archive-card-body,
.studio-month-card .archive-card-footer,
.studio-month-card .archive-card-action {
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.studio-month-card .archive-card-action {
  right: 3.75rem;
}

.archive-card-delete {
  position: absolute;
  right: 1rem;
  top: 1rem;
  z-index: 3;
}

.archive-card-delete-button {
  align-items: center;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 7px;
  color: #be123c;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  width: 34px;
}

.archive-card-delete-button:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #9f1239;
}

.presence-calendar-section {
  border-bottom: 1px solid var(--app-border);
  scroll-margin-top: 1rem;
  padding-bottom: 1.25rem;
}

.presence-toolbar {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.presence-view-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.presence-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.presence-employee-picker {
  max-width: 22rem;
  min-width: min(100%, 16rem);
  position: relative;
  width: 22rem;
  z-index: 5;
}

.presence-employee-select-wrap {
  margin-bottom: 0.45rem;
}

.presence-employee-menu {
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 7px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  left: 0;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.35rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
}

.presence-employee-option {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--app-ink);
  display: block;
  font-size: 0.88rem;
  padding: 0.45rem 0.55rem;
  text-align: left;
  width: 100%;
}

.presence-employee-option:hover,
.presence-employee-option:focus,
.presence-employee-option.active {
  background: #eef4ff;
  outline: none;
}

.presence-calendar-wrap {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  overflow-x: auto;
  width: 100%;
}

.presence-calendar-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  min-width: 1120px;
  table-layout: fixed;
  width: max-content;
}

.presence-calendar-table th,
.presence-calendar-table td {
  border-bottom: 1px solid #e5eaf0;
  border-right: 1px solid #e5eaf0;
  height: 38px;
  padding: 0.25rem;
  text-align: center;
  vertical-align: middle;
  width: 3.25rem;
}

.presence-calendar-table thead th {
  background: #f8fafc;
  color: #334155;
  font-weight: 850;
}

.presence-calendar-label {
  background: #ffffff;
  color: var(--app-ink);
  left: 0;
  min-width: 10.5rem;
  position: sticky;
  text-align: left !important;
  width: 10.5rem !important;
  z-index: 2;
}

.presence-calendar-table thead .presence-calendar-label {
  background: #f1f5f9;
  z-index: 3;
}

.presence-calendar-day {
  font-size: 0.92rem;
}

.presence-calendar-weekday {
  font-size: 0.68rem;
  text-transform: uppercase;
}

.presence-calendar-holiday {
  background: #fff1f2 !important;
  color: #be123c !important;
}

.presence-calendar-theoretical-cell {
  background: #ffffff !important;
  color: var(--app-ink) !important;
}

.presence-employee-highlight {
  outline: 2px solid rgba(36, 84, 166, 0.34);
  outline-offset: 3px;
}

.presence-calendar-input,
.presence-calendar-note {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--app-ink);
  font: inherit;
  height: 28px;
  padding: 0.2rem;
  text-align: center;
  width: 100%;
}

.presence-calendar-input:focus,
.presence-calendar-note:focus {
  background: #ffffff;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.14rem rgba(36, 84, 166, 0.12);
  outline: none;
}

.presence-calendar-input:disabled,
.presence-calendar-note:disabled {
  color: #64748b;
  opacity: 1;
}

.presence-calendar-input-readonly {
  color: #475569;
}

.presence-calendar-detail-row .presence-calendar-label {
  color: #7c2d12;
}

.presence-vertical-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  min-width: 340px;
  table-layout: fixed;
  width: max-content;
}

.presence-vertical-table th,
.presence-vertical-table td {
  border-bottom: 1px solid #e5eaf0;
  border-right: 1px solid #e5eaf0;
  height: 26px;
  padding: 0.06rem;
  text-align: center;
  vertical-align: middle;
  width: 2.35rem;
}

.presence-vertical-table thead th {
  background: #f8fafc;
  color: #334155;
  font-weight: 850;
}

.presence-vertical-table tfoot th,
.presence-vertical-table tfoot td {
  background: #f1f5f9;
  border-top: 2px solid #cbd5e1;
  color: var(--app-ink);
  font-weight: 850;
}

.presence-vertical-table tbody th {
  background: #ffffff;
  color: var(--app-ink);
  font-weight: 800;
  width: 2.25rem;
}

.presence-vertical-weekday {
  color: #64748b;
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.presence-vertical-table .presence-calendar-input {
  border-radius: 4px;
  height: 28px;
  padding: 0.05rem;
}

.presence-worked-input {
  font-weight: 850;
}

.presence-vertical-value {
  display: inline-block;
  min-width: 100%;
  padding: 0.05rem;
}

.presence-worked-value {
  font-weight: 850;
}

.presence-worked-total {
  font-weight: 900 !important;
}

.presence-calendar-note {
  font-size: 0.72rem;
  min-width: 4.5rem;
}

.absence-reason-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.dashboard-quick-card {
  min-height: 150px;
}

.finder-file-tile {
  border: 1px solid transparent;
  border-radius: var(--app-radius);
  color: var(--app-ink);
  display: grid;
  gap: 0.6rem;
  justify-items: center;
  min-height: 210px;
  padding: 0.85rem;
  text-align: center;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.finder-file-tile:hover {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--app-border);
}

.finder-file-tile.is-empty {
  opacity: 0.52;
}

.finder-file-preview {
  align-items: center;
  color: var(--app-ink);
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  text-decoration: none;
}

.finder-file-preview:hover {
  color: var(--app-primary);
}

.finder-file-icon {
  background: #f8fbff;
  border: 2px solid #d8e6ff;
  border-radius: 8px 14px 8px 8px;
  box-shadow: 0 18px 32px rgba(31, 42, 55, 0.14);
  display: grid;
  height: 112px;
  place-items: center;
  position: relative;
  width: 88px;
}

.finder-file-icon::before {
  background: #eaf2ff;
  border-bottom: 2px solid #d8e6ff;
  border-left: 2px solid #d8e6ff;
  border-radius: 0 10px 0 6px;
  content: "";
  height: 26px;
  position: absolute;
  right: -2px;
  top: -2px;
  width: 26px;
}

.finder-file-icon::after {
  background: currentColor;
  border-radius: 999px;
  box-shadow: 0 12px 0 currentColor, 0 24px 0 currentColor;
  content: "";
  height: 3px;
  left: 20px;
  opacity: 0.28;
  position: absolute;
  right: 20px;
  top: 58px;
}

.finder-file-code {
  color: var(--app-primary);
  font-size: 1.12rem;
  font-weight: 900;
  margin-top: -1.3rem;
  position: relative;
  z-index: 1;
}

.doc-card-f24 .finder-file-icon {
  background: #f5fbfa;
  border-color: #cbe7e2;
  color: #0f514d;
}

.doc-card-f24 .finder-file-icon::before {
  background: #e6f5f3;
  border-color: #cbe7e2;
}

.doc-card-f24 .finder-file-code {
  color: #0f514d;
}

.doc-card-accounting_note .finder-file-icon {
  background: #fffaf0;
  border-color: #f4d88b;
  color: #7a4d00;
}

.doc-card-accounting_note .finder-file-icon::before {
  background: #fff3ce;
  border-color: #f4d88b;
}

.doc-card-accounting_note .finder-file-code {
  color: #7a4d00;
}

.finder-file-name,
.finder-file-meta,
.finder-file-note {
  display: block;
}

.finder-file-name {
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.15;
}

.finder-file-meta,
.finder-file-note {
  color: var(--app-muted);
  font-size: 0.78rem;
}

.finder-file-note {
  max-width: 12rem;
}

.studio-file-tile {
  align-content: start;
  min-height: 360px;
}

.studio-file-tile .finder-file-meta,
.studio-file-tile .finder-file-note {
  max-width: 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finder-file-details {
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  min-height: 78px;
}

.finder-file-status {
  min-height: 24px;
}

.studio-file-actions {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr;
  justify-items: stretch;
  width: 100%;
}

.studio-file-actions form,
.studio-file-actions .btn {
  width: 100%;
}

.monthly-doc-actions {
  align-items: center;
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr;
  justify-items: center;
  width: 100%;
}

.monthly-doc-actions .btn {
  min-height: 36px;
}

.monthly-doc-actions form {
  display: grid;
  justify-items: center;
  width: 100%;
}

.archive-section {
  border-top: 1px solid var(--app-border);
  padding-top: 1rem;
}

.archive-subsection + .archive-subsection {
  margin-top: 1rem;
}

.alert {
  border: 0;
  border-radius: var(--app-radius);
  box-shadow: 0 10px 24px rgba(23, 33, 43, 0.08);
}

h1,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  color: var(--app-ink);
  font-weight: 780;
  letter-spacing: 0;
}

.text-muted {
  color: var(--app-muted) !important;
}

.border,
.rounded-2 {
  border-color: var(--app-border) !important;
  border-radius: var(--app-radius) !important;
}

form.border,
.border.rounded-2.p-3,
.border.rounded-2.p-4,
.border.rounded-2.p-3.h-100 {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(31, 42, 55, 0.06);
}

.row.g-3.mb-4 > [class*="col-"] > .border {
  background: var(--app-surface);
  border: 1px solid var(--app-border) !important;
  box-shadow: var(--app-shadow);
}

.form-label {
  color: #405066;
  font-size: 0.82rem;
  font-weight: 760;
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  border-color: var(--app-border);
  border-radius: 7px;
  min-height: 42px;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(36, 84, 166, 0.58);
  box-shadow: 0 0 0 0.2rem rgba(36, 84, 166, 0.12);
}

.form-check-input {
  border-color: #a7b4c2;
}

.form-check-input:checked {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

.table-responsive {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  overflow: auto;
}

.table {
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  border-bottom-color: #edf1f5;
  padding: 0.9rem 1rem;
  vertical-align: middle;
}

.table thead th {
  background: #f7f9fb;
  color: #536274;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table tbody tr:hover {
  background: #fbfdff;
}

.badge {
  border-radius: 999px;
  font-weight: 760;
  padding: 0.38rem 0.58rem;
}

.doc-cell-primary {
  display: grid;
  gap: 0.45rem;
  min-width: 220px;
}

.doc-badge-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.doc-period-badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 850;
  justify-content: center;
  line-height: 1;
  min-height: 30px;
  padding: 0.42rem 0.68rem;
  white-space: nowrap;
}

.doc-period-badge {
  background: #17212b;
  border-color: #17212b;
  box-shadow: 0 8px 16px rgba(23, 33, 43, 0.12);
  color: #fff;
  min-width: 4.8rem;
}

.doc-period-badge.muted {
  background: #e8eef5;
  border-color: #d2dde8;
  box-shadow: none;
  color: var(--app-muted);
}

.doc-type-item {
  align-items: center;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  line-height: 1;
  position: relative;
  width: 72px;
}

.doc-type-payslip,
.doc-type-payslips_company,
.doc-type-payslip_employee {
  color: #17428c;
}

.doc-type-f24 {
  color: #0d5b42;
}

.doc-type-accounting_note {
  color: #7a4d00;
}

.doc-type-cu {
  color: #53389e;
}

.doc-type-contract {
  color: #9d174d;
}

.doc-type-form,
.doc-type-presence_sheet,
.doc-type-other {
  color: #405066;
}

.doc-type-icon {
  border-radius: 3px 5px 3px 3px;
  box-shadow: 0 8px 16px rgba(23, 33, 43, 0.2);
  display: inline-block;
  flex: 0 0 auto;
  height: 27px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  z-index: 2;
}

.doc-type-code {
  color: currentColor;
  font-size: 1.45rem;
  font-weight: 900;
  left: 50%;
  letter-spacing: 0.03em;
  opacity: 0.34;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  z-index: 1;
}

.doc-type-f24 .doc-type-code {
  font-size: 1.55rem;
  letter-spacing: 0.05em;
}

.doc-type-icon::before,
.doc-type-icon::after {
  content: "";
  position: absolute;
}

.doc-type-icon::after {
  background: rgba(255, 255, 255, 0.48);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  height: 8px;
  right: 0;
  top: 0;
  width: 8px;
}

.doc-type-payslip .doc-type-icon,
.doc-type-payslips_company .doc-type-icon,
.doc-type-payslip_employee .doc-type-icon {
  background: #2454a6;
}

.doc-type-payslip .doc-type-icon::before,
.doc-type-payslips_company .doc-type-icon::before,
.doc-type-payslip_employee .doc-type-icon::before {
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 6px 0 #ffffff, 0 12px 0 #ffffff;
  height: 2px;
  left: 5px;
  top: 7px;
  width: 11px;
}

.doc-type-f24 .doc-type-icon {
  background: #0f766e;
}

.doc-type-f24 .doc-type-icon::before {
  border-bottom: 3px solid #ffffff;
  border-left: 3px solid #ffffff;
  height: 11px;
  left: 5px;
  top: 8px;
  width: 11px;
}

.doc-type-accounting_note .doc-type-icon {
  background: #f59e0b;
}

.doc-type-accounting_note .doc-type-icon::before {
  border-bottom: 2px solid #ffffff;
  border-top: 2px solid #ffffff;
  height: 12px;
  left: 5px;
  top: 8px;
  width: 11px;
}

.doc-type-cu .doc-type-icon {
  background: #6d28d9;
}

.doc-type-contract .doc-type-icon {
  background: #be185d;
}

.doc-type-form .doc-type-icon,
.doc-type-presence_sheet .doc-type-icon,
.doc-type-other .doc-type-icon {
  background: #64748b;
}

.company-code-badge {
  align-items: center;
  background: #eef7f6;
  border: 1px solid #b7ded8;
  border-radius: 7px;
  color: #0f514d;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 850;
  min-height: 30px;
  padding: 0.36rem 0.62rem;
  white-space: nowrap;
}

.doc-subject,
.doc-file-meta {
  color: var(--app-muted);
  font-size: 0.82rem;
}

.doc-subject strong {
  color: var(--app-ink);
  font-weight: 760;
}

.doc-file-name {
  color: #334155;
  display: block;
  font-size: 0.84rem;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-bg-primary {
  background-color: #dceaff !important;
  color: #173b78 !important;
}

.text-bg-success {
  background-color: #dff4ed !important;
  color: #0d5b42 !important;
}

.text-bg-danger {
  background-color: #fee4e2 !important;
  color: var(--app-danger) !important;
}

.text-bg-warning,
.table-warning {
  background-color: #fff7df !important;
  color: #6c4600 !important;
}

.text-bg-secondary {
  background-color: #eef2f6 !important;
  color: #405066 !important;
}

code {
  background: #eef4ff;
  border-radius: 6px;
  color: #1f4b91;
  padding: 0.12rem 0.35rem;
}

.btn-group-sm > .btn,
.btn-sm {
  border-radius: 7px;
}

.login-shell {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr) 430px;
  margin: 0 auto;
  max-width: 1040px;
}

.login-panel,
.login-copy {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(223, 230, 238, 0.9);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}

.login-copy {
  align-content: end;
  background:
    linear-gradient(135deg, rgba(24, 61, 124, 0.94), rgba(15, 118, 110, 0.9)),
    #183d7c;
  color: #fff;
  display: grid;
  min-height: 480px;
  padding: 2rem;
}

.login-copy h1,
.login-copy p {
  color: #fff;
}

.login-copy p {
  color: rgba(255, 255, 255, 0.78);
}

.login-panel {
  padding: 2rem;
}

.login-panel .form-control {
  min-height: 46px;
}

.empty-state {
  color: var(--app-muted);
  padding: 2.5rem 1rem;
  text-align: center;
}

@media (max-width: 1199.98px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (min-width: 992px) {
  .app-authenticated .navbar-nav-actions .btn-nav {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .app-topbar {
    position: static;
  }

  .app-shell {
    display: block;
    padding: 1rem;
  }

  .app-sidebar {
    display: none;
  }

  .navbar-nav-actions {
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding-top: 0.75rem;
  }

  .navbar-nav-actions .btn,
  .navbar-nav-actions form,
  .navbar-nav-actions form .btn,
  .navbar-nav-actions .user-chip {
    justify-content: center;
    width: 100%;
  }

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

  .login-copy {
    min-height: 280px;
    order: -1;
  }

  .page-header {
    display: block;
  }

  .month-header {
    display: block;
  }

  .month-header-actions {
    margin-top: 0.75rem;
  }

  .page-actions {
    justify-content: flex-start;
    margin-top: 1rem;
  }

  .dashboard-card-grid,
  .monthly-doc-grid {
    grid-template-columns: 1fr;
  }

  .document-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .document-card-actions {
    flex-wrap: wrap;
  }

  .archive-switch {
    flex: 1 1 150px;
  }
}

@media (max-width: 575.98px) {
  .app-brand-subtitle,
  .user-chip {
    display: none;
  }

  .public-main {
    padding: 1.5rem 1rem;
  }

  .login-panel,
  .login-copy {
    padding: 1.25rem;
  }

  .table > :not(caption) > * > * {
    padding: 0.75rem;
  }

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

  .archive-filter-bar .btn-fixed,
  .document-card-actions .btn-fixed {
    width: 100%;
  }

  .archive-header .page-actions .btn,
  .archive-header .page-actions .form-select {
    width: 100%;
  }

  .month-header-actions {
    display: grid;
    gap: 0.5rem;
  }
}
