:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --ink: #111317;
  --muted: #566173;
  --line: #cfd6df;
  --line-strong: #aeb8c5;
  --nav: #ffffff;
  --nav-2: #f4f6f8;
  --accent: #d71920;
  --accent-dark: #a90f15;
  --accent-soft: #fff1f2;
  --accent-2: #b54708;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 8px 22px rgba(10, 12, 16, 0.08);
  --shadow-soft: 0 1px 2px rgba(10, 12, 16, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(244, 245, 247, 0.96));
  padding: 18px;
}

.login-panel {
  width: min(440px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.login-brand {
  color: var(--ink);
  border-bottom-color: var(--line);
  margin-bottom: 18px;
  justify-content: center;
}

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

.login-form h1 {
  margin: 0;
}

.app-locked {
  filter: blur(2px);
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.sidebar {
  background: var(--nav);
  color: var(--ink);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.brand-logo {
  display: block;
  width: 210px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.login-brand .brand-logo {
  width: 210px;
  max-height: 82px;
  padding: 10px;
  border-color: var(--line);
}

.brand-copy {
  min-width: 0;
}

.sidebar .brand {
  flex-direction: column;
  align-items: flex-start;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.login-brand span {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 5px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  color: #252a32;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.nav button:hover,
.nav button.active {
  background: var(--nav-2);
  color: var(--ink);
  box-shadow: inset 4px 0 0 var(--accent);
}

.nav .nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.nav .nav-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}

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

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view {
  padding: 24px 26px 42px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card-body {
  padding: 18px;
}

.stat {
  min-height: 116px;
}

.stat strong {
  display: block;
  font-size: 25px;
  margin-top: 10px;
}

.stat span,
.muted {
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar h2,
.card h2,
.card h3 {
  margin: 0;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.button {
  color: #ffffff;
  background: var(--accent);
}

.button:hover {
  background: var(--accent-dark);
}

.ghost-button,
.icon-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  color: #ffffff;
  background: var(--danger);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cloud-status.saved {
  border-color: #b7e4c7;
  background: #ecfdf3;
  color: #067647;
}

.cloud-status.syncing {
  border-color: #fedf89;
  background: #fffaeb;
  color: #b54708;
}

.cloud-status.offline {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b42318;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #eef4ff;
  color: #175cd3;
}

.status.ok {
  background: #ecfdf3;
  color: var(--ok);
}

.status.warn {
  background: #fffaeb;
  color: var(--accent-2);
}

.status.danger {
  background: #fef3f2;
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfe;
}

tbody tr:hover {
  background: #f8fafc;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  color: var(--accent);
}

.clickable-card,
.clickable-list-item {
  cursor: pointer;
}

.clickable-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.clickable-list-item:hover {
  color: var(--accent);
}

tbody tr.row-warning,
tbody tr.row-warning:hover {
  background: #fffbeb;
}

tbody tr.row-expired,
tbody tr.row-expired:hover {
  background: #fef3f2;
}

tbody tr.row-warning td:first-child {
  border-left: 4px solid var(--accent-2);
}

tbody tr.row-expired td:first-child {
  border-left: 4px solid var(--danger);
}

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

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.form-section {
  margin: 22px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.form-section:first-of-type {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.compact-field {
  max-width: 180px;
}

.compact-field input {
  text-align: center;
  font-weight: 800;
}

.ot-input {
  max-width: 84px;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  min-height: 72px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.employee-popup-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.employee-popup-title h3 {
  margin: 0;
  font-size: 24px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}

.modal-panel {
  position: absolute;
  inset: 28px;
  max-width: 1180px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 2px 0 0;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.section-title {
  margin: 26px 0 12px;
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #17252b;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 340px;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.notification-center {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
}

.notification-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  cursor: pointer;
  font-weight: 800;
}

.notification-toggle strong {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--muted);
  color: #ffffff;
}

.notification-center.has-alerts .notification-toggle {
  border-color: #fbbf24;
}

.notification-center.has-alerts .notification-toggle strong {
  background: var(--danger);
}

.notification-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(380px, calc(100vw - 32px));
  max-height: 420px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
}

.notification-center.open .notification-panel {
  display: block;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.notification-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notification-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.notification-item:hover {
  background: #f8fafc;
}

.notification-item.warning {
  border-left: 4px solid var(--accent-2);
}

.notification-item.expired {
  border-left: 4px solid var(--danger);
}

.notification-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notification-item strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.notification-empty {
  padding: 18px 14px;
  color: var(--muted);
}

.download-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 14px;
  margin-top: 18px;
  background: var(--accent-soft);
}

.doc-thumb,
.inline-file-preview {
  display: inline-grid;
  grid-template-columns: 44px minmax(80px, 1fr);
  align-items: center;
  gap: 8px;
  max-width: 240px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 6px;
  cursor: pointer;
  text-align: left;
}

.inline-file-preview {
  margin-top: 8px;
  width: 100%;
}

.doc-thumb img,
.inline-file-preview img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.doc-thumb span,
.inline-file-preview span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #eef4ff;
  color: #175cd3;
  font-weight: 800;
  font-size: 11px;
}

.doc-thumb small,
.inline-file-preview small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-preview-box {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 18px;
  overflow: hidden;
}

.document-preview-box img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.document-preview-box iframe {
  width: 100%;
  height: 440px;
  border: 0;
}

.document-preview-box span {
  font-size: 32px;
  font-weight: 800;
  color: var(--muted);
}

.mobile-only {
  display: none;
}

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

.amount {
  font-weight: 800;
  white-space: nowrap;
}

.split-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compact-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.compact-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Accounting / operations style */
.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(17, 19, 23, 0.04);
}

.sidebar .brand {
  gap: 8px;
  padding: 6px 6px 14px;
  margin-bottom: 10px;
}

.sidebar .brand-logo {
  width: 198px;
  max-height: 52px;
  border-radius: 6px;
  padding: 7px;
}

.brand strong {
  font-size: 14px;
  line-height: 1.1;
}

.nav {
  gap: 2px;
}

.nav button {
  min-height: 36px;
  border-radius: 4px;
  padding: 7px 9px;
  font-size: 14px;
}

.nav button:hover,
.nav button.active {
  background: #fff5f5;
}

.nav .nav-icon {
  width: 30px;
  height: 30px;
}

.topbar {
  min-height: 72px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.topbar h1 {
  font-size: 22px;
}

.view {
  padding: 18px 20px 32px;
}

.grid {
  gap: 12px;
}

.card {
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
}

.card-body {
  padding: 14px 16px;
}

.stat {
  min-height: 96px;
}

.stat strong {
  font-size: 24px;
  margin-top: 6px;
}

.toolbar {
  min-height: 40px;
  gap: 10px;
  margin: 18px 0 8px;
  padding: 0 2px;
}

.toolbar:first-child {
  margin-top: 0;
}

.toolbar h2,
.card h2 {
  font-size: 20px;
}

.section-title {
  margin: 20px 0 8px;
}

.button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 34px;
  border-radius: 4px;
  padding: 7px 11px;
  font-size: 14px;
}

.ghost-button,
.icon-button {
  background: #f8fafc;
}

.ghost-button:hover,
.icon-button:hover {
  background: #eef1f5;
  border-color: var(--line-strong);
}

.pill {
  min-height: 26px;
  border-radius: 4px;
  background: #f8fafc;
  padding: 4px 8px;
}

.status {
  border-radius: 4px;
  padding: 4px 7px;
}

.table-wrap {
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
}

th,
td {
  padding: 8px 10px;
  font-size: 14px;
}

th {
  color: #435064;
  background: #f1f4f8;
  border-bottom: 1px solid var(--line-strong);
}

tbody tr:nth-child(even) {
  background: #fbfcfe;
}

tbody tr:hover {
  background: #fff7f7;
}

input,
select,
textarea {
  min-height: 34px;
  border-radius: 4px;
  padding: 7px 9px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(215, 25, 32, 0.18);
  border-color: var(--accent);
}

.form-grid {
  gap: 10px;
}

.form-section {
  margin: 18px 0 10px;
  padding-top: 12px;
}

.detail-grid {
  gap: 10px;
}

.detail-item {
  border-radius: 4px;
  background: #f8fafc;
  min-height: 64px;
  padding: 10px;
}

.modal-panel {
  border-radius: 4px;
}

.modal-header {
  background: #f8fafc;
  padding: 14px 18px;
}

.modal-body {
  padding: 16px 18px;
}

.notification-toggle,
.notification-panel,
.doc-thumb,
.inline-file-preview,
.document-preview-box,
.toast,
.login-panel,
.brand-logo {
  border-radius: 4px;
}

@media (max-width: 1040px) {
  .stats,
  .three-col,
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(310px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 30;
  }

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

  .mobile-only {
    display: inline-flex;
  }

  .topbar {
    align-items: flex-start;
    padding: 16px;
    flex-wrap: wrap;
  }

  .topbar-actions {
    display: flex;
    width: 100%;
    justify-content: flex-start;
  }

  .view {
    padding: 16px;
  }

  .stats,
  .three-col,
  .two-col,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .modal-panel {
    inset: 12px;
  }

  .modal-header,
  .employee-popup-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .notification-center {
    right: 12px;
    bottom: 12px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-actions,
  .toolbar-actions > * {
    width: 100%;
  }
}
