:root {
  --navy: #0B1F33;
  --navy-soft: #12324F;
  --brand-soft: var(--navy-soft);
  --teal: #0DAA91;
  --teal-dark: #07836F;
  --accent-dark: var(--teal-dark);
  --gold: #D9A441;
  --gold-dark: #966711;
  --warning-dark: var(--gold-dark);
  --white: #FFFFFF;
  --bg: #F5F7FA;
  --panel: #FFFFFF;
  --panel-soft: #F8FAFC;
  --ink: #233142;
  --muted: #64748B;
  --line: #E7ECF2;
  --brand: var(--navy);
  --brand-ink: #ffffff;
  --accent: var(--teal);
  --warning: var(--gold);
  --danger: #B42318;
  --success-bg: rgba(13, 170, 145, 0.12);
  --success-ink: var(--teal-dark);
  --warning-bg: rgba(217, 164, 65, 0.18);
  --warning-ink: var(--gold-dark);
  --neutral-bg: rgba(100, 116, 139, 0.12);
  --neutral-ink: #475569;
  --danger-bg: rgba(180, 35, 24, 0.11);
  --danger-ink: #912018;
  --shadow: 0 20px 50px rgba(11, 31, 51, 0.10);
  --shadow-soft: 0 14px 34px rgba(11, 31, 51, 0.08);
  --radius-card: 22px;
  --radius-control: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(13, 170, 145, 0.10), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 46%, #eef3f8 100%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--brand);
}

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

button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  border-color: rgba(13, 170, 145, 0.45);
  background: rgba(13, 170, 145, 0.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:disabled:hover {
  border-color: var(--line);
  background: var(--white);
}

.login-page,
.app-body,
.public-upload-body {
  min-height: 100vh;
}

.login-shell,
.public-upload-shell,
.single-column {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card,
.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 440px);
  padding: 2rem;
}

.admin-log-shell {
  place-items: stretch;
}

.app-shell.single-column.admin-log-shell {
  grid-template-columns: minmax(0, 1fr);
}

.admin-log-panel {
  width: 100%;
  margin: 0 auto;
  padding: 1.6rem;
}

.admin-log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-nav {
  display: flex;
  gap: 0.5rem;
  margin: -0.4rem 0 1rem;
}

.admin-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}

.admin-nav a:hover {
  border-color: var(--accent);
}

.admin-nav a[aria-current="page"] {
  border-color: var(--accent);
  background: rgba(13, 170, 145, 0.10);
}

.admin-ops-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.admin-ops-summary article,
.admin-ops-staleness,
.admin-ops-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.admin-ops-summary article {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem;
}

.admin-ops-summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-ops-staleness,
.admin-ops-group {
  padding: 1rem;
  margin-top: 1rem;
}

.admin-ops-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.85rem;
}

.admin-ops-check h3,
.admin-ops-group h2,
.admin-ops-staleness h2 {
  margin: 0;
}

.admin-ops-check p,
.admin-ops-staleness p {
  margin: 0.35rem 0 0;
}

.admin-ops-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  border-radius: 999px;
  padding: 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.admin-ops-status-pass {
  color: #14604d;
  background: rgba(13, 170, 145, 0.14);
}

.admin-ops-status-warn {
  color: #7b4e00;
  background: rgba(217, 164, 65, 0.2);
}

.admin-ops-status-fail {
  color: #8f2020;
  background: rgba(190, 55, 55, 0.14);
}

.admin-ops-status-unknown {
  color: var(--muted);
  background: rgba(51, 64, 77, 0.08);
}

.admin-ticket-frame {
  width: 100%;
  height: 72vh;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.admin-ticket-missing {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: var(--white);
}

@media (max-width: 900px) {
  .admin-ops-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-log-entry {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
}

.admin-log-entry h2 {
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.admin-log-content {
  max-height: 28rem;
  overflow: auto;
  margin: 0.7rem 0 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #071827;
  color: #e6f7f4;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.login-card h1,
.workspace-header h1,
.panel h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.04em;
}

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

.stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.48rem 0.7rem;
  background: var(--white);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(13, 170, 145, 0.55);
  box-shadow: 0 0 0 3px rgba(13, 170, 145, 0.12);
}

textarea {
  resize: vertical;
}

.primary-button,
.google-button,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  background: var(--teal);
  color: var(--brand-ink);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(13, 170, 145, 0.22);
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.primary-button:hover,
.action-link:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.settings-save-button {
  justify-self: start;
  width: auto;
  max-width: 8rem;
}

.settings-panel {
  display: grid;
  gap: 1.15rem;
  max-width: 54rem;
  padding: 1.15rem;
}

.settings-section {
  display: grid;
  gap: 0.72rem;
}

.settings-section-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-section h2 {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.google-button {
  width: 100%;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.google-button:hover {
  border-color: rgba(13, 170, 145, 0.45);
  background: var(--white);
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

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

.app-shell.single-column {
  display: grid;
  grid-template-columns: minmax(0, 760px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #dbe8f4;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  font-weight: 700;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--teal), var(--navy-soft));
  color: var(--white);
}

.login-brand {
  margin-bottom: 1.25rem;
  color: var(--navy);
}

.workspace-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
}

.workspace-nav-main,
.workspace-nav-bottom {
  display: grid;
  gap: 0.35rem;
}

.workspace-nav-bottom {
  margin-top: auto;
}

.nav-link {
  display: block;
  border-radius: 16px;
  padding: 0.82rem 0.9rem;
  color: #dbe8f4;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.workspace-main {
  min-width: 0;
  padding: 1.5rem;
}

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

.workspace-header-side {
  display: grid;
  justify-items: end;
  gap: 0.75rem;
}

.workspace-period-control {
  display: grid;
  grid-template-columns: minmax(8.5rem, 1fr) minmax(8.5rem, 1fr);
  align-items: center;
  gap: 0.45rem;
  max-width: 300px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.workspace-period-control input {
  min-height: 2rem;
  padding: 0.32rem 0.45rem;
  border-radius: 11px;
  font-size: 0.82rem;
}

.workspace-period-control small {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: right;
}

.user-chip {
  display: grid;
  gap: 0.2rem;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.88);
  text-align: right;
}

.logout-link {
  justify-self: end;
  width: max-content;
  border: 1px solid rgba(13, 170, 145, 0.22);
  border-radius: 999px;
  padding: 0.2rem 0.52rem;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.logout-link:hover {
  background: rgba(13, 170, 145, 0.10);
}

.user-chip small {
  color: var(--muted);
}

.panel {
  padding: 1rem;
}

.workspace-filter-panel,
.workspace-action-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.workspace-filter-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
}

.workspace-filter-form .workspace-period-control {
  margin-left: auto;
}

.workspace-action-bar {
  min-height: 3.2rem;
}

.workspace-refresh-status {
  margin: -0.2rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.workspace-action-bar-split {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(18rem, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  padding: 0.75rem;
}

.action-bar-half {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0;
}

.action-bar-left {
  justify-content: flex-start;
}

.action-bar-right {
  justify-content: flex-end;
}

.action-bar-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.action-upload-form,
.bulk-action-form,
.document-create-control {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
}

.styled-file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.styled-file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.36rem 0.78rem;
  border: 1px solid rgba(13, 170, 145, 0.24);
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.file-picker-hint {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.document-create-control {
  position: relative;
}

.document-create-control summary,
.manual-transaction-control summary {
  min-height: 2rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid rgba(13, 170, 145, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  list-style: none;
}

.document-create-control summary::-webkit-details-marker,
.manual-transaction-control summary::-webkit-details-marker {
  display: none;
}

.document-create-form,
.manual-transaction-create-form {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.5rem);
  left: 0;
  display: grid;
  width: min(30rem, 88vw);
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.manual-transaction-control {
  position: relative;
}

.manual-transaction-create-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(34rem, 90vw);
}

.document-create-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(42rem, 92vw);
}

.document-create-form label:nth-of-type(10),
.document-create-form button {
  grid-column: 1 / -1;
}

.manual-transaction-create-form label:nth-of-type(2),
.manual-transaction-create-form .manual-create-error {
  grid-column: 1 / -1;
}

.request-empty-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.05rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.empty-state-copy,
.request-empty-card p {
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.45;
}

.archive-toggle {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
}

.archive-toggle input {
  min-height: 0;
}

.filter-row-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(13, 170, 145, 0.08)) right / 2rem 100% no-repeat,
    var(--white);
}

.table-scroll:focus {
  outline: 2px solid rgba(13, 170, 145, 0.38);
  outline-offset: 3px;
}

.bulk-action-form button,
td button {
  min-height: 2rem;
  padding: 0.34rem 0.62rem;
  border-color: rgba(13, 170, 145, 0.24);
  background: rgba(255, 255, 255, 0.9);
  color: var(--navy);
  font-size: 0.82rem;
}

td form {
  display: inline;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(245, 247, 250, 0.88));
}

.table-controls-footer {
  justify-content: flex-end;
  margin: 0.9rem 0 0;
  align-items: center;
}

.table-controls-footer .filter-row-count {
  margin-right: auto;
  white-space: nowrap;
}

.table-page-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
  padding: 0.48rem 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.table-page-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-page-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  min-width: 1.6rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.table-control {
  width: min(100%, 220px);
}

.table-control-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  width: auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.table-control-page-size select {
  width: 4.4rem;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0 1.65rem 0 0.72rem;
  font-size: 0.82rem;
}

.table-page-size-suffix {
  white-space: nowrap;
}

.table-control-page-select {
  width: 96px;
}

.table-control-compact {
  width: min(18vw, 190px);
  min-width: 150px;
}

table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.62rem 0.68rem;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
}

th {
  position: sticky;
  top: 0;
  background: #F8FAFC;
  z-index: 1;
}

thead tr:first-child th {
  border-bottom: 0;
  padding-bottom: 0.28rem;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(13, 170, 145, 0.06);
}

.match-unavailable {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

td input,
td select,
td textarea {
  min-height: 2rem;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  font-size: 0.88rem;
}

td textarea {
  min-height: 3.3rem;
  line-height: 1.25;
  resize: vertical;
}

.table-sort {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.column-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  margin-right: 0.22rem;
}

.sort-arrow-button {
  min-height: 1rem;
  min-width: 1rem;
  vertical-align: middle;
}

.table-filter-row th {
  position: sticky;
  top: 2.4rem;
  z-index: 1;
  padding-top: 0.02rem;
  background: #F8FAFC;
}

.table-filter-cell {
  overflow: visible;
}

.table-header-filter-form {
  display: none;
}

.header-filter-control {
  display: block;
  width: 100%;
  min-width: 0;
}

.header-filter-control span:not(.sr-only) {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.header-filter-control select,
.header-filter-control input {
  width: 100%;
  height: 1.95rem;
  min-height: 1.95rem;
  border-radius: 999px;
  padding: 0 0.72rem;
  font-size: 0.76rem;
  line-height: 1.95rem;
}

.header-filter-date {
  position: relative;
}

.header-filter-date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.38rem;
  min-width: 6.9rem;
}

.header-date-filter-button {
  display: inline-flex;
  align-items: center;
  width: 100%;
  height: 1.95rem;
  min-height: 1.95rem;
  border-radius: 0.52rem;
  padding: 0 0.46rem;
  justify-content: center;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.95rem;
  white-space: nowrap;
}

.header-date-picker-input {
  position: absolute;
  right: 0.4rem;
  bottom: 0.2rem;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.actions-column {
  width: 1%;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.editable-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.12rem;
}

.editable-cell-textarea {
  align-items: stretch;
}

.editable-cell-match {
  align-items: start;
  min-width: 0;
}

.editable-cell-match:not(.is-editing) select {
  display: none;
}

.editable-cell-match.is-editing .match-readout {
  display: none;
}

.match-readout {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  line-height: 1.25;
  white-space: normal;
}

.match-readout strong,
.match-readout span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.match-readout strong {
  font-size: 0.86rem;
}

.match-readout span {
  color: var(--muted);
  font-size: 0.78rem;
}

.editable-cell input[readonly],
.editable-cell textarea[readonly],
.editable-cell select:disabled {
  color: var(--ink);
  border-color: rgba(100, 116, 139, 0.22);
  background: transparent;
  box-shadow: none;
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}

.editable-cell select:disabled {
  appearance: none;
}

.editable-cell:not(.is-editing) input[readonly],
.editable-cell:not(.is-editing) textarea[readonly],
.editable-cell:not(.is-editing) select:disabled,
.editable-cell-match:not(.is-editing) .match-readout {
  cursor: text;
}

.editable-cell:not(.is-editing):hover input[readonly],
.editable-cell:not(.is-editing):focus-within input[readonly],
.editable-cell:not(.is-editing):hover textarea[readonly],
.editable-cell:not(.is-editing):focus-within textarea[readonly],
.editable-cell:not(.is-editing):hover select:disabled,
.editable-cell:not(.is-editing):focus-within select:disabled,
.editable-cell-match:not(.is-editing):hover .match-readout,
.editable-cell-match:not(.is-editing):focus-within .match-readout {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(13, 170, 145, 0.34);
}

input[type="checkbox"].row-select,
input[type="checkbox"][data-select-all="true"],
.request-items-table input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  margin: 0;
  accent-color: var(--teal);
}

.manual-add-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 1px solid rgba(13, 170, 145, 0.42);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
}

.declarations-help {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.05rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.declarations-help {
  margin-top: 1rem;
}

.declarations-help summary {
  cursor: pointer;
  font-weight: 800;
}

.declarations-help dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0.9rem 0 0;
}

.declarations-help div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.82rem;
  background: var(--panel-soft);
}

.declarations-help dt {
  margin-bottom: 0.32rem;
  font-weight: 900;
}

.declarations-help dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.38;
}

.declaration-form-panel {
  display: grid;
  gap: 0.85rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.declaration-form-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.declaration-form-table {
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--white);
}

.declaration-form-table th,
.declaration-form-table td {
  padding: 0.78rem 0.85rem;
}

.declaration-form-table th:nth-child(1),
.declaration-form-table td:nth-child(1) {
  width: 6.5rem;
  color: var(--teal-dark);
  font-weight: 900;
}

.declaration-form-table td:nth-child(3),
.declaration-form-table td:nth-child(4) {
  text-align: right;
  font-weight: 900;
}

.declaration-review-strip {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  border: 1px dashed rgba(217, 164, 65, 0.52);
  border-radius: 18px;
  padding: 0.72rem 0.9rem;
  background: var(--warning-bg);
  color: var(--warning-ink);
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.manual-create-error {
  display: block;
  margin-top: 0.2rem;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 700;
}

.currency-code {
  color: var(--muted);
  font-size: 0.62em;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.currency-code-inline {
  display: inline-block;
  margin: 0.18rem 0 0 0.18rem;
}

.column-currency-code {
  font-size: 0.58em;
}

.sort-arrow {
  min-width: 1ch;
  color: var(--teal);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.summary-cards-polished {
  align-items: stretch;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.05rem;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 250, 0.92)),
    var(--white);
  box-shadow: var(--shadow-soft);
}

.summary-card h2 {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.summary-card p {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  border-radius: 999px;
  padding: 0.24rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.save-state {
  display: inline-block;
  min-width: 2.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.save-state:empty {
  display: none;
}

.quiet-save-button {
  margin-top: 0.35rem;
  min-height: 1.75rem;
  border-color: rgba(100, 116, 139, 0.22);
  padding: 0.2rem 0.48rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.quiet-save-button:hover {
  background: rgba(100, 116, 139, 0.10);
  color: var(--ink);
}

.compact-cell {
  display: inline-block;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.compact-cell-source,
.compact-cell-filename,
.compact-cell-match {
  max-width: clamp(7.5rem, 12vw, 14rem);
}

.compact-cell-problem {
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.compact-cell-source {
  display: -webkit-box;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.25;
  white-space: normal;
}

.two-line-cell {
  display: grid;
  gap: 0.16rem;
  max-width: clamp(10rem, 22vw, 22rem);
  overflow: hidden;
}

.two-line-cell > span,
.two-line-cell > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.description-display {
  display: block;
  max-width: clamp(10rem, 22vw, 22rem);
}

.description-display-textarea {
  width: 100%;
  min-height: 3.3rem;
  border-style: dotted;
  background: transparent;
  line-height: 1.25;
  resize: vertical;
}

.two-line-cell > small {
  color: var(--muted);
  font-size: 0.72rem;
}

.vat-pill {
  margin: 0 0.35rem 0.35rem 0;
}

.vat-pill-affects {
  background: var(--success-bg);
  color: var(--success-ink);
}

.vat-pill-no-vat {
  background: var(--neutral-bg);
  color: var(--neutral-ink);
}

.vat-pill-unclear {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.document-status-pill-ready {
  background: var(--success-bg);
  color: var(--success-ink);
}

.document-status-pill-pending {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.document-status-pill-invalid {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.narrow-panel {
  width: min(100%, 760px);
}

.public-upload-card {
  position: relative;
  padding: 2rem;
}

.public-upload-company {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.98;
}

.public-upload-subtitle {
  margin: 0.9rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.public-upload-ai-link {
  color: var(--teal-dark);
  font-weight: 900;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.public-upload-divider {
  height: 1px;
  margin: 1.25rem 0 0.9rem;
  background: var(--line);
}

.public-upload-powered {
  position: absolute;
  right: 1.1rem;
  bottom: 0.86rem;
  margin: 0;
  color: rgba(108, 113, 119, 0.72);
  font-size: 0.72rem;
}

.public-upload-powered a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.not-found-panel {
  padding: 2rem;
}

.not-found-path {
  display: inline-block;
  margin: 0.4rem 0 1.4rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.82rem;
}

.request-list {
  display: grid;
  gap: 1.85rem;
  margin: 1.85rem 0 0;
  padding: 0;
  list-style: none;
}

.document-summary-list {
  display: grid;
  gap: 0.32rem;
  min-width: 12rem;
  margin: 0;
}

.document-summary-list div {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0.5rem;
}

.document-summary-list dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.document-summary-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.request-builder,
.request-review {
  display: grid;
  gap: 0.82rem;
}

.request-card,
.request-group-card {
  display: grid;
  gap: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.82rem;
  background: rgba(255, 255, 255, 0.9);
}

.request-card h3,
.request-group-card h3 {
  margin: 0;
}

.request-item-list {
  display: grid;
  gap: 0.42rem;
  padding: 0;
  margin: 0;
}

.request-item-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.56rem 0.64rem;
  background: var(--white);
}

article.request-item-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.request-item-card-excluded {
  opacity: 0.68;
}

.request-item-copy {
  display: grid;
  gap: 0.16rem;
}

.request-state-pill {
  width: max-content;
  background: var(--neutral-bg);
  color: var(--neutral-ink);
}

.request-workbench {
  display: grid;
  gap: 0.82rem;
}

.request-workbench-section {
  display: grid;
  gap: 0.82rem;
}

.request-builder + .table-panel {
  margin-top: 0.82rem;
}

.request-counterparty-card {
  display: grid;
  gap: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 0.82rem 0.82rem;
  background: var(--white);
}

.request-card-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 -0.82rem;
  padding: 10px 0.82rem;
  border-radius: 18px 18px 0 0;
  background: var(--white);
}

.request-card-header h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.request-contact-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.38rem;
  margin: 0;
  font-size: 0.82rem;
}

.request-contact-pill {
  display: inline-grid;
  align-items: center;
  min-height: 1.9rem;
  max-width: 20rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-contact-pill.editable-cell {
  grid-template-columns: minmax(8rem, 1fr) 2.08rem;
  gap: 0;
}

.request-contact-pill input {
  min-height: 1.45rem;
  min-width: 7rem;
  outline: none;
  border: 0;
  border-radius: 0;
  padding: 0.2rem 0.58rem 0.2rem 0.72rem;
  background: transparent;
  font-size: 0.86rem;
}

.request-contact-pill input:focus,
.request-contact-pill input:focus-visible {
  outline: 0;
  box-shadow: none;
}

.request-contact-pill:focus-within {
  border-color: rgba(13, 170, 145, 0.48);
  box-shadow: 0 0 0 2px rgba(13, 170, 145, 0.14);
}

.request-contact-send {
  align-self: stretch;
  min-width: 2.08rem;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0 0.46rem;
  background: transparent;
  font-size: 0.82rem;
  line-height: 1;
}

.request-contact-send:disabled {
  background: rgba(231, 236, 242, 0.65);
}

.request-contact-pill.save-error {
  border-color: var(--danger);
}

.request-contact-pill-email {
  border-color: rgba(100, 116, 139, 0.28);
  color: var(--navy);
}

.request-contact-pill-whatsapp {
  border-color: rgba(13, 170, 145, 0.32);
  color: var(--teal-dark);
}

.request-context-group {
  display: grid;
  gap: 0.36rem;
}

.request-context-group h3,
.request-context-group h4,
.request-upload-group h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.request-card-actions,
.request-drafts,
.channel-actions,
.channel-action-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.48rem;
}

.request-drafts {
  margin-top: 0.08rem;
}

.channel-action {
  white-space: nowrap;
}

.request-channel-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.48rem;
  padding-top: 0.64rem;
  border-top: 1px solid var(--line);
}

.channel-label {
  color: var(--muted);
  font-weight: 700;
}

.segmented-channel-actions {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}

.segmented-channel-actions .channel-action {
  border: 0;
  border-radius: 0;
  padding: 0.58rem 0.86rem;
}

.segmented-channel-actions .channel-action + .channel-action {
  border-left: 1px solid var(--line);
}

.channel-action-email {
  color: var(--navy);
}

.channel-action-email:hover {
  background: rgba(100, 116, 139, 0.10);
}

.channel-action-whatsapp {
  color: var(--teal-dark);
}

.channel-action-whatsapp:hover {
  background: rgba(13, 170, 145, 0.10);
}

.request-items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.request-items-table th,
.request-items-table td {
  padding: 0.52rem 0.58rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.request-counterparty-card .request-items-table th {
  top: 3.2rem;
  z-index: 3;
}

.request-items-table-suggestions col:nth-child(1) {
  width: 3.2rem;
}

.request-items-table-suggestions col:nth-child(2),
.request-items-table-open col:nth-child(1) {
  width: 7.8rem;
}

.request-items-table-suggestions col:nth-child(3),
.request-items-table-open col:nth-child(2) {
  width: 6.4rem;
}

.request-items-table-suggestions col:nth-child(4),
.request-items-table-open col:nth-child(3) {
  width: auto;
}

.request-items-table-suggestions col:nth-child(5),
.request-items-table-open col:nth-child(4) {
  width: 13rem;
}

.request-items-table-suggestions col:nth-child(6),
.request-items-table-open col:nth-child(5) {
  width: 8.5rem;
}

.request-description-cell,
.public-request-item-context span:last-child {
  overflow-wrap: anywhere;
}

.request-item-context {
  display: grid;
  grid-template-columns: 7rem 9rem 6rem minmax(12rem, 1fr);
  gap: 0.55rem;
  align-items: start;
  color: var(--ink);
  font-size: 0.9rem;
}

.public-request-item-context {
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 0.75rem;
  padding: 0.35rem 0;
}

.public-request-date,
.public-request-amount {
  white-space: nowrap;
}

.public-upload-item {
  display: grid;
  gap: 1rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.public-upload-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.public-upload-item form {
  display: flex;
  flex-wrap: wrap;
  column-gap: calc(0.65rem + 10px);
  row-gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.request-reason {
  display: block;
  color: var(--warning-ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.draft-preview-block {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.draft-preview-block h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-preview {
  margin: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem;
  background: var(--white);
  color: var(--ink);
  white-space: pre-wrap;
}

.copyable-url {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.draft-action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.document-add-form,
.document-add-fieldset {
  display: grid;
  gap: 0.45rem;
}

.document-add-form strong {
  color: var(--warning-ink);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.document-add-fieldset {
  grid-template-columns: 1fr;
}

.document-add-fieldset-wide {
  grid-template-columns: 1fr;
}

.warning-text {
  color: var(--danger);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-nav-main,
  .workspace-nav-bottom {
    display: contents;
  }

  .workspace-header,
  .upload-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-header-side {
    justify-items: stretch;
  }

  .workspace-period-control {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .workspace-filter-form,
  .workspace-action-bar-split {
    flex-wrap: wrap;
    grid-template-columns: 1fr;
  }

  .user-chip {
    min-width: 0;
    text-align: left;
  }

  .logout-link {
    justify-self: start;
  }

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

  .settings-panel,
  .settings-section-grid,
  .declarations-breakdown dl {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
