:root {
  --ink: #2d3132;
  --muted: #667071;
  --line: #d9e2e2;
  --paper: #f8fbfa;
  --panel: #ffffff;
  --field: #f1f7f6;
  --brand: #08b3ac;
  --brand-dark: #07847f;
  --accent: #ff5b52;
  --lime: #43d61f;
  --sky: #10bce8;
  --ok: #218c50;
  --wait: #8a5b13;
  --danger: #9f2f28;
  --shadow: 0 18px 42px rgba(3, 67, 69, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  background: #273032;
  color: #f7faf6;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand > div {
  min-width: 0;
  margin-right: auto;
}

.mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  object-fit: cover;
  flex: 0 0 auto;
}

.sidebar .mark {
  width: 48px;
  height: 48px;
}

.mobile-settings-button {
  display: none;
}

.mobile-menu-button {
  display: none;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand span,
.user-panel span,
.small {
  color: #c9d4ce;
  font-size: 12px;
}

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

.nav button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav button {
  padding: 0 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.user-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.main {
  min-width: 0;
  padding: 24px;
}

.flash-message {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 20;
  width: min(360px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(8, 179, 172, 0.35);
  border-radius: 8px;
  color: var(--brand-dark);
  background: #e9fbfa;
  box-shadow: 0 12px 28px rgba(3, 67, 69, 0.16);
  font-weight: 800;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2,
.auth h1,
.section-title h3 {
  margin: 0;
}

.topbar h2 {
  font-size: 25px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.document-notice {
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(8, 179, 172, 0.35);
  border-radius: 8px;
  color: var(--brand-dark);
  background: #e9fbfa;
  font-weight: 800;
}

.language-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(8, 179, 172, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
}

.language-toggle button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.language-toggle button.active {
  color: #fff;
  background: var(--brand);
}

.sidebar .language-toggle {
  width: fit-content;
  color: #f7faf6;
  border-color: rgba(255, 255, 255, 0.18);
}

.primary,
.secondary,
.danger {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

.primary {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 2px 0 rgba(7, 132, 127, 0.24);
}

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

.secondary {
  color: var(--ink);
  background: #e5f5f3;
}

#newDocument,
#newClient,
#newVendor {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 3px 0 rgba(159, 47, 40, 0.24);
  font-weight: 900;
}

#newDocument:hover,
#newClient:hover,
#newVendor:hover {
  background: #e4473f;
}

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

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.icon-only {
  width: 34px;
  padding: 0;
  font-size: 15px;
}

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

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

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

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

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.project-page {
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(0, 0.58fr);
  gap: 18px;
  align-items: start;
}

.project-workspace {
  display: grid;
  gap: 18px;
}

.document-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.document-list {
  display: grid;
  gap: 6px;
}

.document-editor {
  min-width: 0;
}

.document-lines {
  display: grid;
  gap: 10px;
}

.document-line {
  display: grid;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.document-line .field,
.document-editor .field {
  min-width: 0;
}

.invoice-document .document-line {
  grid-template-columns: 76px 150px minmax(190px, 1fr) 100px 120px 120px 42px;
}

.quote-document .document-line {
  grid-template-columns: 76px minmax(190px, 1fr) 100px 120px 120px 42px;
}

.quote-document .invoice-project-field {
  display: none;
}

.document-line .compact {
  min-width: 34px;
  padding: 0;
}

.document-totals {
  width: min(340px, 100%);
  margin-left: auto;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.document-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.document-totals div:last-child {
  color: var(--brand-dark);
  font-size: 18px;
}

.month-picker {
  width: min(220px, 100%);
}

.financial-summary h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.financial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.category-totals {
  display: grid;
  gap: 8px;
}

.financial-entry-panel {
  display: grid;
  gap: 16px;
}

.financial-entry-picker {
  width: min(420px, 100%);
}

.financial-entry-form {
  max-width: 860px;
}

.financial-form {
  padding-top: 4px;
}

.category-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.financial-table-title {
  padding: 18px 18px 0;
}

.invoice-ledger {
  display: grid;
  gap: 8px;
}

.invoice-ledger-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(4, auto);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.invoice-ledger-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.project-detail {
  min-width: 0;
}

.project-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.project-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.file-loader {
  display: grid;
  gap: 10px;
}

.file-tools {
  display: flex;
  justify-content: flex-end;
}

.panel,
.auth,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(31, 39, 38, 0.04);
}

.panel {
  padding: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.dashboard-list {
  display: grid;
  gap: 12px;
}

.recent-activity-panel {
  display: grid;
  gap: 12px;
}

.recent-activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 74px minmax(150px, 0.7fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfc;
  text-align: left;
}

.activity-item.new {
  border-color: rgba(255, 91, 82, 0.45);
  background: #fff4f2;
}

.activity-item.read {
  opacity: 0.74;
}

.activity-item:hover {
  border-color: var(--brand);
}

.activity-status {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.activity-item.read .activity-status {
  color: var(--muted);
  background: #e5f5f3;
}

.activity-item strong,
.activity-item small,
.activity-item em {
  display: block;
}

.activity-item small,
.activity-item em {
  color: var(--muted);
  font-size: 12px;
}

.activity-item em {
  font-style: normal;
  white-space: nowrap;
}

.activity-text {
  overflow-wrap: anywhere;
}

.dashboard-table-panel {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.dashboard-table {
  min-width: 920px;
}

.dashboard-table th,
.dashboard-table td {
  vertical-align: middle;
  font-size: 12px;
  padding: 10px 8px;
}

.dashboard-table .pill {
  font-size: 12px;
}

.link-button {
  min-height: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
}

.link-button:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.table-date {
  min-width: 118px;
  min-height: 34px;
  font-size: 12px;
}

.date-display {
  min-width: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-display .icon-button {
  width: 28px;
  min-height: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 900;
}

.date-display .icon-button:hover {
  border-color: var(--brand);
  background: #e9fbfa;
}

.customer-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.customer-list-item {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.customer-list-item:hover,
.customer-list-item.active {
  border-color: rgba(8, 179, 172, 0.36);
  background: #e9fbfa;
}

.search-field {
  margin-bottom: 4px;
}

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

.activity-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e9fbfa;
  color: var(--ink);
}

.activity-line strong {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.activity-line span {
  overflow-wrap: anywhere;
}

.activity-line em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.card {
  padding: 15px;
  display: grid;
  gap: 9px;
}

.card h3,
.card p {
  margin: 0;
}

.card h3 {
  font-size: 17px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.field textarea {
  min-height: 94px;
  resize: vertical;
}

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

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.pill {
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.approved {
  color: #12592f;
  background: #dbf7d4;
}

.pending {
  color: #704711;
  background: #f6e8c7;
}

.admin {
  color: #77351f;
  background: #f3d8ce;
}

.status-initial-customer-request {
  color: #6c4b0f;
  background: #fff0c7;
}

.status-development {
  color: #075d5b;
  background: #d8fbf7;
}

.status-development-completed {
  color: #176016;
  background: #dcf8d6;
}

.status-delivered-pending-payment {
  color: #793a23;
  background: #ffe0d9;
}

.status-delivered-completed {
  color: #324044;
  background: #e4e9ea;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 47% 28%, rgba(255, 255, 255, 0.24), transparent 20rem),
    linear-gradient(135deg, #05aaa5, #09b7b2 54%, #078d89);
}

.auth {
  width: min(960px, 100%);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  box-shadow: var(--shadow);
}

.auth-copy {
  padding: 34px;
  color: #fff;
  background: rgba(45, 49, 50, 0.88);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.auth-copy h1 {
  font-size: 36px;
  line-height: 1.02;
}

.auth-copy p {
  color: #d9e2dd;
  line-height: 1.5;
}

.auth-form {
  padding: 30px;
  display: grid;
  gap: 14px;
}

.divider {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.google-button {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.notice {
  padding: 12px;
  border-radius: 8px;
  background: #e7fbfa;
  color: #075d5b;
  border: 1px solid #aae6e3;
}

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

.section-heading {
  margin-bottom: 10px;
}

.section-heading h3 {
  margin: 0 0 3px;
}

.status-field {
  min-width: 240px;
  padding: 10px;
  border: 2px solid rgba(255, 91, 82, 0.65);
  border-radius: 8px;
  background: #fff4f2;
  box-shadow: 0 0 0 3px rgba(255, 91, 82, 0.10);
}

.project-status-inline {
  width: min(360px, 100%);
  margin: 0 0 16px;
}

.status-field label {
  color: var(--danger);
  font-weight: 900;
}

.status-field select {
  border-color: var(--accent);
  background: #fff;
  font-weight: 900;
}

.messages {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.message {
  border-left: 3px solid var(--accent);
  background: #fff4f2;
  padding: 10px;
  border-radius: 0 8px 8px 0;
}

.message strong {
  display: block;
  font-size: 13px;
}

.message p {
  margin: 5px 0 0;
  line-height: 1.35;
}

.files {
  display: grid;
  gap: 10px;
}

.file-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.file-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.file-summary span {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  padding: 16px;
}

.clickable {
  cursor: pointer;
}

.clickable:hover {
  border-color: var(--brand);
}

.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(8, 179, 172, 0.16);
}

.file-summary small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.file-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.file-actions .compact {
  min-height: 32px;
  font-size: 12px;
}

.report-controls {
  display: grid;
  gap: 12px;
}

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

.report-summary h2 {
  font-size: 22px;
}

.report-table {
  min-width: 920px;
}

.report-pl-panel {
  display: grid;
  gap: 10px;
}

.pl-lines {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.pl-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.pl-line:last-child {
  border-bottom: 0;
}

.pl-line.strong {
  background: #eef9f8;
}

.pl-line span {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pl-line strong {
  white-space: nowrap;
}

.report-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 14px;
    gap: 10px;
  }

  .sidebar .brand {
    justify-content: space-between;
  }

  .mobile-settings-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    font-size: 18px;
    flex: 0 0 auto;
  }

  .nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .user-panel {
    display: none;
    margin-top: 0;
    padding-top: 10px;
  }

  .user-panel.open {
    display: grid;
  }

  .workspace,
  .document-workspace,
  .project-page,
  .project-columns,
  .activity-line,
  .activity-item,
  .document-line,
  .financial-layout,
  .report-filter-grid,
  .two,
  .three,
  .four,
  .auth {
    grid-template-columns: 1fr;
  }

  .status-field {
    min-width: 0;
    width: 100%;
  }

  .document-editor,
  .document-line {
    min-width: 0;
  }

  .invoice-document .document-line,
  .quote-document .document-line {
    grid-template-columns: 1fr;
  }

  .document-line .compact {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .main,
  .auth-form,
  .auth-copy {
    padding: 18px;
  }

  .nav {
    display: none;
    grid-template-columns: 1fr;
    gap: 6px;
    padding-top: 4px;
  }

  .mobile-menu-button {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    flex: 0 0 auto;
  }

  .nav.open {
    display: grid;
  }

  .nav button {
    min-height: 36px;
    padding: 0 9px;
    font-size: 13px;
  }

  .sidebar .mark {
    width: 42px;
    height: 42px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand span {
    font-size: 11px;
  }

  .topbar,
  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .document-workspace .panel,
  .document-editor {
    padding: 14px;
  }

  .document-line {
    padding: 10px;
  }

  .document-totals {
    width: 100%;
  }

.primary,
.secondary,
.danger {
    width: 100%;
  }
}

.compact {
  min-height: 34px;
  padding: 0 10px;
}
