/* ==========================================================================
   GrowGlobal Suite — Design System
   Palette: orange primary on near-black chrome. Typography: Poppins.
   ========================================================================== */

:root {
  /* Brand */
  --c-primary:        #F26522;
  --c-primary-hover:  #D9541A;
  --c-primary-light:  #FFF1EA;
  --c-primary-border: #FFD4BF;

  /* Chrome — near-black sidebar, matching the reference UI */
  --c-sidebar:        #16181D;
  --c-sidebar-hover:  #22252C;
  --c-sidebar-active: #F26522;
  --c-sidebar-text:   #9BA1AC;
  --c-sidebar-head:   #5D636E;

  /* Surfaces */
  --c-bg:      #F5F6F8;
  --c-surface: #FFFFFF;
  --c-border:  #E4E7EC;
  --c-border-strong: #D0D5DD;

  /* Text */
  --c-text:      #1A1D23;
  --c-text-soft: #5D6470;
  --c-text-mute: #98A0AC;

  /* Semantic */
  --c-green:  #12925A;  --c-green-bg:  #E7F6EE;
  --c-red:    #D42F2F;  --c-red-bg:    #FDECEC;
  --c-amber:  #B25E09;  --c-amber-bg:  #FDF3E4;
  --c-blue:   #1957C2;  --c-blue-bg:   #E8F0FD;
  --c-gray:   #5D6470;  --c-gray-bg:   #F0F1F4;

  /* Scale */
  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow:    0 4px 12px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 28px rgba(16,24,40,.12);

  --sidebar-w: 244px;
  --topbar-h:  62px;
  --gutter:    clamp(16px, 2.2vw, 30px);

  --ease: .2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

h1,h2,h3,h4,h5 { font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }

/* Numbers in tables must align — tabular figures */
.num, td.num, .amount, .table-money {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-sidebar);
  color: var(--c-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transition: transform var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-brand .mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--c-primary);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.sidebar-brand .name {
  color: #fff; font-weight: 600; font-size: 14.5px;
  line-height: 1.2; letter-spacing: -.01em;
}
.sidebar-brand .name small {
  display: block; font-size: 10.5px; font-weight: 400;
  color: var(--c-sidebar-head); letter-spacing: .04em; text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px;
  scrollbar-width: thin;
  scrollbar-color: #3A3F49 transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #3A3F49; border-radius: 3px; }

.nav-section {
  font-size: 10px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--c-sidebar-head);
  padding: 16px 12px 7px;
}

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--c-sidebar-text);
  font-size: 13.5px; font-weight: 500;
  transition: background var(--ease), color var(--ease);
  margin-bottom: 2px;
}
.nav-link i { width: 17px; font-size: 14px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: var(--c-sidebar-hover); color: #E8EAEE; }
.nav-link.active { background: var(--c-sidebar-active); color: #fff; font-weight: 600; }
.nav-link .badge-count {
  margin-left: auto; background: rgba(255,255,255,.14);
  padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.nav-link.active .badge-count { background: rgba(0,0,0,.22); }

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
}
.sidebar-user:hover { background: var(--c-sidebar-hover); }
.sidebar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px; flex-shrink: 0;
}
.sidebar-user .meta { min-width: 0; }
.sidebar-user .meta b {
  display: block; color: #E8EAEE; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user .meta span { font-size: 10.5px; color: var(--c-sidebar-head); }

/* ---- Main column ---- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--gutter);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .spacer { flex: 1; }

.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--c-border);
  background: #fff; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 16px; color: var(--c-text);
}

.content { padding: var(--gutter); flex: 1; }

.sidebar-scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(16,24,40,.5);
  z-index: 55;
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* ---- Cards ---- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-foot {
  padding: 13px 18px; border-top: 1px solid var(--c-border);
  background: #FAFBFC; border-radius: 0 0 var(--radius) var(--radius);
}

/* ---- Stat tiles ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), transform var(--ease);
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--c-text-mute);
  margin-bottom: 9px;
}
.stat .label i { color: var(--c-primary); font-size: 12px; }
.stat .value {
  font-size: 23px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat .sub { font-size: 11.5px; color: var(--c-text-soft); margin-top: 5px; }
.stat .sub .up   { color: var(--c-green); font-weight: 600; }
.stat .sub .down { color: var(--c-red);   font-weight: 600; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left;
  padding: 10px 15px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--c-text-mute);
  background: #FAFBFC;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
table.data td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #FAFBFC; }
table.data .strong { font-weight: 600; }
table.data .muted { color: var(--c-text-soft); font-size: 12px; }
table.data tfoot td {
  padding: 12px 15px; font-weight: 600;
  background: #FAFBFC; border-top: 2px solid var(--c-border-strong);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  white-space: nowrap;
  background: #fff;
}
.btn i { font-size: 12px; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-dark { background: var(--c-sidebar); color: #fff; }
.btn-dark:hover { background: #2A2E36; }
.btn-outline { background: #fff; border-color: var(--c-border-strong); color: var(--c-text); }
.btn-outline:hover { border-color: var(--c-text-soft); background: #FAFBFC; }
.btn-ghost { background: transparent; color: var(--c-text-soft); }
.btn-ghost:hover { background: var(--c-gray-bg); color: var(--c-text); }
.btn-danger { background: var(--c-red); color: #fff; }
.btn-danger:hover { background: #B22525; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--c-green-bg); color: var(--c-green); }
.badge-red   { background: var(--c-red-bg);   color: var(--c-red); }
.badge-amber { background: var(--c-amber-bg); color: var(--c-amber); }
.badge-blue  { background: var(--c-blue-bg);  color: var(--c-blue); }
.badge-gray  { background: var(--c-gray-bg);  color: var(--c-gray); }
.badge-orange{ background: var(--c-primary-light); color: var(--c-primary-hover); }

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-full { grid-column: 1 / -1; }

label {
  font-size: 12.5px; font-weight: 500; color: var(--c-text);
  display: flex; align-items: center; gap: 5px;
}
label .req { color: var(--c-red); }
label .hint { font-weight: 400; color: var(--c-text-mute); font-size: 11.5px; }

.input, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--c-text);
  font-size: 13.5px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(242,101,34,.13);
}
input[readonly], input:disabled, select:disabled {
  background: #F5F6F8; color: var(--c-text-soft); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 76px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235D6470' d='M6 8.5L2 4.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--c-primary); cursor: pointer; }

.field-error { color: var(--c-red); font-size: 11.5px; }
.input-error { border-color: var(--c-red) !important; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon {
  display: grid; place-items: center;
  padding: 0 11px;
  border: 1px solid var(--c-border-strong); border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #F5F6F8; color: var(--c-text-soft);
  font-size: 12.5px; white-space: nowrap;
}

/* ---- Alerts ---- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: var(--c-green-bg); color: #0B6E44; border-color: #B7E4CD; }
.alert-error   { background: var(--c-red-bg);   color: #A32020; border-color: #F5C2C2; }
.alert-warn    { background: var(--c-amber-bg); color: #8A4808; border-color: #F5DDB4; }
.alert-info    { background: var(--c-blue-bg);  color: #14449B; border-color: #BCD4F7; }
.alert ul { margin: 4px 0 0 2px; }
.alert li { list-style: disc; margin-left: 14px; }

/* ---- Page header ---- */
.page-head {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { color: var(--c-text-soft); font-size: 13px; margin-top: 3px; }
.page-head .spacer { flex: 1; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--c-border);
  background: #FAFBFC;
  border-radius: var(--radius) var(--radius) 0 0;
}
.filter-bar .search { flex: 1; min-width: 200px; position: relative; }
.filter-bar .search i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--c-text-mute); font-size: 12.5px; pointer-events: none;
}
.filter-bar .search input { padding-left: 32px; }
.filter-bar select { width: auto; min-width: 130px; }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 52px 20px; }
.empty .icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 50%; background: var(--c-primary-light);
  color: var(--c-primary);
  display: grid; place-items: center; font-size: 22px;
}
.empty h3 { font-size: 15px; margin-bottom: 5px; }
.empty p { color: var(--c-text-soft); font-size: 13px; margin-bottom: 16px; }

/* ---- Invoice line editor ---- */
.line-table { width: 100%; border-collapse: collapse; }
.line-table th {
  padding: 9px 10px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--c-text-mute); text-align: left;
  background: #FAFBFC; border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.line-table td {
  padding: 7px 8px; border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.line-table input, .line-table select {
  padding: 7px 9px; font-size: 13px;
}
.line-table .row-drag { color: var(--c-text-mute); cursor: grab; text-align: center; width: 30px; }
.line-table .row-del {
  background: none; border: none; color: var(--c-text-mute);
  cursor: pointer; padding: 6px; border-radius: 5px; font-size: 13px;
}
.line-table .row-del:hover { color: var(--c-red); background: var(--c-red-bg); }
.line-computed {
  font-size: 12px; color: var(--c-text-soft);
  font-variant-numeric: tabular-nums; text-align: right;
  padding-top: 14px; white-space: nowrap;
}

/* ---- Totals panel ---- */
.totals { max-width: 380px; margin-left: auto; }
.totals-row {
  display: flex; justify-content: space-between; gap: 20px;
  padding: 7px 0; font-size: 13.5px;
}
.totals-row .lbl { color: var(--c-text-soft); }
.totals-row .val { font-variant-numeric: tabular-nums; font-weight: 500; }
.totals-row.divider { border-top: 1px solid var(--c-border); margin-top: 5px; padding-top: 12px; }
.totals-row.grand {
  border-top: 2px solid var(--c-sidebar);
  margin-top: 7px; padding-top: 12px;
  font-size: 16px; font-weight: 700;
}
.totals-row.grand .val { color: var(--c-primary); }
.words-box {
  margin-top: 12px; padding: 11px 13px;
  background: var(--c-primary-light);
  border: 1px solid var(--c-primary-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.5;
}
.words-box b { display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c-primary-hover); margin-bottom: 3px; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--c-border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 10px 15px; font-size: 13.5px; font-weight: 500;
  color: var(--c-text-soft); border-bottom: 2px solid transparent;
  white-space: nowrap; cursor: pointer;
}
.tab:hover { color: var(--c-text); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 5px; justify-content: center; padding: 15px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 33px; height: 33px; padding: 0 9px;
  display: grid; place-items: center;
  border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
  font-size: 12.5px; background: #fff; color: var(--c-text);
}
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination .active span { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 600; }
.pagination .disabled span { opacity: .45; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16,24,40,.55);
  display: none; place-items: center;
  z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 470px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--c-border); }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: 9px;
}

/* ---- Impersonation banner ---- */
.impersonation-bar {
  background: var(--c-sidebar); color: #fff;
  padding: 8px var(--gutter);
  font-size: 12.5px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.impersonation-bar i { color: var(--c-primary); }
.impersonation-bar .spacer { flex: 1; }
.impersonation-bar form { display: inline; }
.impersonation-bar button {
  background: rgba(255,255,255,.14); color: #fff;
  border: none; padding: 4px 11px; border-radius: 5px;
  font-size: 12px; cursor: pointer;
}
.impersonation-bar button:hover { background: rgba(255,255,255,.24); }

/* ---- Progress / ageing bars ---- */
.bar { height: 7px; background: var(--c-gray-bg); border-radius: 4px; overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }
.bar .b-current { background: var(--c-green); }
.bar .b-30  { background: #7CB342; }
.bar .b-60  { background: var(--c-primary); }
.bar .b-90  { background: #E5761B; }
.bar .b-90p { background: var(--c-red); }

/* ---- Misc ---- */
.divider { height: 1px; background: var(--c-border); margin: 18px 0; }
.text-muted { color: var(--c-text-soft); }
.text-mute  { color: var(--c-text-mute); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:18px}.mt-4{margin-top:24px}
.mb-1{margin-bottom:6px}.mb-2{margin-bottom:12px}.mb-3{margin-bottom:18px}.mb-4{margin-bottom:24px}
.flex { display: flex; }
.flex-gap { display: flex; gap: 10px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }

/* Definition rows used on detail screens */
.dl { display: grid; grid-template-columns: 145px 1fr; gap: 8px 14px; font-size: 13px; }
.dl dt { color: var(--c-text-soft); }
.dl dd { font-weight: 500; }

/* ==========================================================================
   AUTH
   ========================================================================== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-visual {
  background: var(--c-sidebar);
  color: #fff;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-visual::after {
  content: ''; position: absolute;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(242,101,34,.22), transparent 68%);
  right: -140px; bottom: -140px;
}
.auth-visual .brand { display: flex; align-items: center; gap: 11px; position: relative; z-index: 2; }
.auth-visual .brand .mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--c-primary); display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
}
.auth-visual .brand b { font-size: 17px; font-weight: 600; }
.auth-visual .pitch { position: relative; z-index: 2; }
.auth-visual .pitch h2 { font-size: 27px; line-height: 1.25; margin-bottom: 14px; font-weight: 600; }
.auth-visual .pitch p { color: #A6ACB7; font-size: 14px; line-height: 1.75; max-width: 400px; }
.auth-visual .feats { display: flex; flex-direction: column; gap: 11px; margin-top: 26px; }
.auth-visual .feats div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #C9CED6; }
.auth-visual .feats i { color: var(--c-primary); }
.auth-visual .foot { font-size: 12px; color: #6C727D; position: relative; z-index: 2; }

.auth-form {
  display: grid; place-items: center;
  padding: 40px 24px;
  background: var(--c-surface);
}
.auth-box { width: 100%; max-width: 372px; }
.auth-box h1 { font-size: 24px; margin-bottom: 6px; }
.auth-box .lede { color: var(--c-text-soft); font-size: 13.5px; margin-bottom: 26px; }
.auth-box .field { margin-bottom: 15px; }
.auth-box .btn { width: 100%; padding: 11px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .field.span-2 { grid-column: span 1; }
}

@media (max-width: 992px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form { background: var(--c-bg); }
  .auth-box {
    background: #fff; padding: 30px 26px;
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
  }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.open { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; place-items: center; }
  .topbar h1 { font-size: 15.5px; }
}

@media (max-width: 700px) {
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 11px; }
  .stat { padding: 13px 14px; }
  .stat .value { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 18px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .totals { max-width: none; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; font-size: 11.5px; }
  /* Line editor scrolls horizontally rather than crushing inputs */
  .line-table { min-width: 720px; }
  .filter-bar { padding: 11px 13px; }
  .card-body { padding: 14px; }
  .card-head { padding: 13px 14px; }
  table.data th, table.data td { padding: 10px 12px; }
}

@media (max-width: 480px) {
  :root { --gutter: 13px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   PRINT — invoice output
   ========================================================================== */
@media print {
  .sidebar, .topbar, .no-print, .page-actions, .impersonation-bar { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; font-size: 11px; }
  .card { border: none; box-shadow: none; }
  @page { size: A4; margin: 12mm; }
}
/* =========================================================
   APPEND TO public/assets/css/app.css
   Additions for the Receipts list (and reusable elsewhere)
   ========================================================= */

/* ---- Amber emphasis (money that needs attention) ---- */
.text-warn      { color: var(--c-amber); }
.stat .value.warn { color: var(--c-amber); }

/* ---- Clickable table rows ---- */
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: #FAFBFC; }
tr.row-link:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: -2px;
}
table.data .cell-link { color: inherit; text-decoration: none; }
tr.row-link:hover .cell-link { color: var(--c-primary); }

/* ---- Payment mode chip ---- */
.mode-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--c-gray-bg);
  color: var(--c-text-soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  white-space: nowrap;
}

/* ---- Table cell helpers ---- */
table.data td.nowrap { white-space: nowrap; }
table.data td.truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Legacy aliases ----
   Kept so any older markup still using .stat-row / .stat-label /
   .stat-value / .stat-sub renders correctly instead of falling
   back to unstyled defaults. New views should use .stat-grid
   with nested .label / .value / .sub. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--c-text-mute);
  margin-bottom: 9px;
}
.stat-value {
  font-size: 23px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-sub { font-size: 11.5px; color: var(--c-text-soft); margin-top: 5px; }

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .stat-grid, .stat-row { grid-template-columns: 1fr; gap: 12px; }
  .stat .value, .stat-value { font-size: 20px; }
  table.data td.truncate { max-width: 140px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .search { flex: 1 1 100%; }
}
