/* ============================================================
   GREENCO SALES CRM - Global Stylesheet
   Colours: Navy #1e2235 | Green #a2c533
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,700;1,400&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'DM Sans', sans-serif; background: #f0f1f4; color: #1a1a2e; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── CSS Variables ── */
:root {
  --navy:        #1e2235;
  --navy-light:  #2a3050;
  --green:       #a2c533;
  --green-dark:  #7a9426;
  --green-light: #eaf3de;
  /* Green for TEXT on white: --green (#a2c533) is ~2:1 contrast - unreadable
     for links/labels. Keep --green for fills and icons. */
  --green-text:  #3B6D11;
  --white:       #ffffff;
  --bg:          #f0f1f4;
  --bg-card:     #ffffff;
  --border:      rgba(0,0,0,0.08);
  --border-med:  rgba(0,0,0,0.14);
  --text-primary:   #1a1a2e;
  --text-secondary: #666880;
  --text-muted:     #6b6d82;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --sidebar-w:  220px;
  --topbar-h:   52px;
}

/* ── Layout ── */
.gc-app          { display: flex; min-height: 100vh; }
.gc-sidebar      { width: var(--sidebar-w); background: var(--navy); position: fixed; top: 0; left: 0; height: 100vh; display: flex; flex-direction: column; z-index: 100; }
.gc-content-wrap { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; } /* min-width:0 - a flex child otherwise grows to its widest content, so a wide table (the fees list) pushed the whole page to ~1700px instead of scrolling inside .gc-table-wrap */
.gc-topbar       { height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 90; }
.gc-page         { flex: 1; padding: 24px; }

/* ── Sidebar ── */
.gc-sidebar-logo { padding: 16px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.gc-sidebar-logo img { width: 148px; height: auto; }

/* The menu is taller than a laptop screen (eSign, Templates, Reports, Admin…
   sat below the fold with an invisible overlay scrollbar). Tighter spacing,
   a visible thin scrollbar, and a soft glow at the edge that still has more
   items (scroll-shadow: the navy covers fade away as you reach each end). */
.gc-nav          { flex: 1; overflow-y: auto; padding: 8px 0;
                   scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent;
                   background:
                     linear-gradient(var(--navy) 30%, rgba(30,34,53,0)) top / 100% 36px no-repeat local,
                     linear-gradient(rgba(30,34,53,0), var(--navy) 70%) bottom / 100% 36px no-repeat local,
                     radial-gradient(farthest-side at 50% 0, rgba(255,255,255,0.16), rgba(255,255,255,0)) top / 100% 12px no-repeat scroll,
                     radial-gradient(farthest-side at 50% 100%, rgba(255,255,255,0.16), rgba(255,255,255,0)) bottom / 100% 12px no-repeat scroll; }
.gc-nav::-webkit-scrollbar { width: 6px; }
.gc-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 3px; }
.gc-nav-section  { font-size: 9px; color: rgba(255,255,255,0.45); letter-spacing: 2px; text-transform: uppercase; padding: 10px 18px 4px; }
.gc-nav a        { display: flex; align-items: center; gap: 10px; padding: 7px 18px; font-size: 13px; color: rgba(255,255,255,0.6); transition: all 0.12s; }
.gc-nav a:hover  { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.05); }
.gc-nav a.active { color: #fff; background: rgba(162,197,51,0.15); border-left: 2.5px solid var(--green); padding-left: 15.5px; }
.gc-nav a i      { font-size: 16px; flex-shrink: 0; }
.gc-nav-badge    { margin-left: auto; background: var(--green); color: var(--navy); font-size: 10px; font-weight: 500; padding: 1px 7px; border-radius: 10px; }

.gc-sidebar-user { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.07); display: flex; align-items: center; gap: 10px; }
.gc-user-avatar  { width: 32px; height: 32px; border-radius: 50%; background: var(--green); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: var(--navy); flex-shrink: 0; }
.gc-user-name    { font-size: 12px; color: #fff; font-weight: 500; }
.gc-user-role    { font-size: 10px; color: rgba(255,255,255,0.32); }

/* ── Topbar ── */
.gc-topbar-left .page-title { font-size: 15px; font-weight: 500; color: var(--text-primary); margin: 0; line-height: inherit; }
.gc-topbar-left .page-breadcrumb { font-size: 11px; color: var(--text-muted); }
.gc-topbar-right { display: flex; align-items: center; gap: 12px; }
.gc-topbar-btn   { width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); font-size: 16px; position: relative; transition: all 0.12s; }
.gc-topbar-btn:hover { border-color: var(--border-med); background: #fff; }
.gc-notif-badge  { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); border: 1.5px solid #fff; }
.gc-topbar-btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); border-radius: var(--radius-md); padding: 0 16px; height: 34px; font-size: 13px; font-family: 'DM Sans', sans-serif; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background 0.15s; }
.gc-topbar-btn-primary:hover { background: var(--green); color: var(--navy); border-color: var(--green); }

/* ── Cards ── */
.gc-card         { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.gc-card-header  { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 12px; border-bottom: 1px solid var(--border); }
.gc-card-header h3 { font-size: 13px; font-weight: 500; color: var(--text-primary); display: flex; align-items: center; gap: 7px; }
.gc-card-header h3 i { color: var(--green); font-size: 15px; }
.gc-card-header .card-action { font-size: 12px; color: var(--green-text); cursor: pointer; }
.gc-card-body    { padding: 18px; }
/* Bare "form cards" place fields straight in .gc-card without a padded
   .gc-card-body (or header), leaving inputs flush to the card edge. Give those
   cards the same inner padding. Cards that already have a .gc-card-body/header
   are excluded, so this never double-pads a well-formed card. */
.gc-card:not(:has(> .gc-card-body)):not(:has(> .gc-card-header)) { padding: 18px; }

/* ── Stat cards ── */
.gc-stats-grid   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.gc-stat-card    { display: block; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
a.gc-stat-card:hover { border-color: var(--green); box-shadow: 0 2px 10px rgba(30,34,53,0.08); transform: translateY(-1px); }
a.gc-stat-card:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.gc-stat-label   { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; }
.gc-stat-value   { font-size: 26px; font-weight: 500; color: var(--text-primary); line-height: 1; }
.gc-stat-delta   { font-size: 11px; margin-top: 5px; }
.gc-stat-delta.up   { color: #3B6D11; }
.gc-stat-delta.down { color: #A32D2D; }
.gc-stat-delta.warn { color: #854F0B; }
.gc-stat-bar     { height: 3px; border-radius: 2px; background: var(--green); margin-top: 12px; }

/* ── Tables ── */
.gc-table        { width: 100%; border-collapse: collapse; font-size: 13px; }
.gc-table th     { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 500; color: var(--text-secondary); border-bottom: 1px solid var(--border); background: #fafafa; text-transform: uppercase; letter-spacing: 0.5px; }
.gc-table td     { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
.gc-table tr:last-child td { border-bottom: none; }
.gc-table tr:hover td { background: #fafbfc; cursor: pointer; }

/* ── Status badges ── */
.gc-badge        { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 500; }
.gc-badge-green  { background: #eaf3de; color: #3B6D11; }
.gc-badge-amber  { background: #faeeda; color: #854F0B; }
.gc-badge-blue   { background: #e6f1fb; color: #185FA5; }
.gc-badge-teal   { background: #e1f5ee; color: #0F6E56; }
.gc-badge-red    { background: #fcebeb; color: #A32D2D; }
.gc-badge-navy   { background: #e8e9f0; color: #1e2235; }
.gc-badge-grey   { background: #f0f0f0; color: #666; }

/* ── Forms ── */
.gc-form-group   { margin-bottom: 18px; }
.gc-label        { display: block; font-size: 11px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 7px; }
.gc-input        { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border-med); border-radius: var(--radius-md); font-size: 14px; font-family: 'DM Sans', sans-serif; color: var(--text-primary); background: #fff; outline: none; transition: border-color 0.15s; }
.gc-input:focus  { border-color: var(--green); }
.gc-select       { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border-med); border-radius: var(--radius-md); font-size: 14px; font-family: 'DM Sans', sans-serif; color: var(--text-primary); background: #fff; outline: none; }
.gc-textarea     { width: 100%; padding: 10px 14px; border: 1px solid var(--border-med); border-radius: var(--radius-md); font-size: 14px; font-family: 'DM Sans', sans-serif; color: var(--text-primary); background: #fff; outline: none; resize: vertical; min-height: 100px; }
.gc-textarea:focus { border-color: var(--green); }

/* ── Buttons ── */
.gc-btn          { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.15s; border: none; }
.gc-btn-primary  { background: var(--navy); color: #fff; }
.gc-btn-primary:hover { background: var(--green); color: var(--navy); } /* white on lime read ~2:1 */
.gc-btn-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-med); }
.gc-btn-secondary:hover { border-color: var(--navy); color: var(--navy); }
.gc-btn-green    { background: var(--green); color: var(--navy); }
.gc-btn-green:hover { background: var(--green-dark); }
.gc-btn-danger   { background: #fcebeb; color: #A32D2D; border: 1px solid #f7c1c1; }
.gc-btn-danger:hover { background: #f7c1c1; }
.gc-btn-sm       { height: 32px; padding: 0 12px; font-size: 12px; }

/* ── Progress / milestone tracker ── */
.gc-milestone-track { padding: 8px 0; }
.gc-milestone       { display: flex; align-items: flex-start; padding: 8px 0; gap: 14px; }
.gc-milestone-dot   { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; margin-top: 1px; }
.gc-milestone-dot.done    { background: var(--green); color: var(--navy); }
.gc-milestone-dot.current { background: var(--navy); color: var(--green); }
.gc-milestone-dot.pending { background: #f0f0f0; border: 2px solid #ddd; }
.gc-milestone-line  { width: 2px; height: 16px; background: #e0e0e0; margin: 2px 0 2px 11px; }
.gc-milestone-label { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.gc-milestone-label.done { color: var(--text-secondary); }
.gc-milestone-label.pending { color: var(--text-muted); font-weight: 400; }
.gc-milestone-date  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.gc-milestone-current-tag { display: inline-block; font-size: 10px; background: var(--navy); color: var(--green); padding: 2px 8px; border-radius: 8px; margin-top: 3px; }

/* ── Property thumbnail ── */
.gc-prop-thumb   { position: relative; width: 44px; height: 36px; border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.gc-prop-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gc-prop-thumb-fallback { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--green); display: flex; align-items: center; justify-content: center; }

/* ── Grids ── */
.gc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.gc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.gc-grid-sidebar { display: grid; grid-template-columns: 1fr 320px; gap: 18px; }
.gc-grid-sidebar-wide { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }

/* ── Flash messages ── */
.gc-flash        { padding: 12px 18px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.gc-flash-success { background: #eaf3de; color: #3B6D11; border: 1px solid #c0dd97; }
.gc-flash-error   { background: #fcebeb; color: #A32D2D; border: 1px solid #f7c1c1; }
.gc-flash-info    { background: #e6f1fb; color: #185FA5; border: 1px solid #b5d4f4; }

/* ── Filters bar ── */
.gc-filters      { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.gc-filter-input { height: 36px; padding: 0 12px; border: 1px solid var(--border-med); border-radius: var(--radius-md); font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; min-width: 200px; }
.gc-filter-input:focus { border-color: var(--green); }
.gc-filter-select { height: 36px; padding: 0 10px; border: 1px solid var(--border-med); border-radius: var(--radius-md); font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; background: #fff; }

/* ── Tabs ── */
.gc-tabs         { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 0; }
.gc-tab          { padding: 10px 18px; font-size: 13px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.12s; }
.gc-tab:hover    { color: var(--text-primary); }
.gc-tab.active   { color: var(--navy); border-bottom-color: var(--green); font-weight: 500; }

/* ── Empty state ── */
.gc-empty        { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.gc-empty > i    { font-size: 40px; margin-bottom: 12px; display: block; color: #ddd; }
/* (Only the big decorative icon - `.gc-empty i` also hit the icon inside the
   call-to-action button and drew a huge grey + over its label.) */
.gc-empty p      { font-size: 14px; }

/* ── Investment calculator ── */
.gc-calc-row     { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.gc-calc-row:last-child { border-bottom: none; }
.gc-calc-label   { color: var(--text-secondary); }
.gc-calc-value   { font-weight: 500; color: var(--text-primary); }
.gc-calc-total   { background: var(--navy); color: #fff; padding: 14px 18px; border-radius: var(--radius-md); display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; font-weight: 500; }
.gc-yield-badge  { display: inline-flex; align-items: center; gap: 6px; background: var(--green-light); color: #3B6D11; padding: 6px 14px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; }

/* ── AML status ── */
.gc-aml-pass     { display: flex; align-items: center; gap: 8px; background: #eaf3de; border-radius: var(--radius-md); padding: 10px 14px; }
.gc-aml-pass i   { color: #3B6D11; font-size: 18px; }
.gc-aml-fail     { display: flex; align-items: center; gap: 8px; background: #fcebeb; border-radius: var(--radius-md); padding: 10px 14px; }
.gc-aml-fail i   { color: #A32D2D; font-size: 18px; }
.gc-aml-refer    { display: flex; align-items: center; gap: 8px; background: #faeeda; border-radius: var(--radius-md); padding: 10px 14px; }
.gc-aml-refer i  { color: #854F0B; font-size: 18px; }
.gc-aml-pending  { display: flex; align-items: center; gap: 8px; background: #f0f0f0; border-radius: var(--radius-md); padding: 10px 14px; }

/* ── Pagination ── */
.gc-pagination   { display: flex; align-items: center; gap: 6px; padding: 14px 18px; border-top: 1px solid var(--border); font-size: 13px; }
.gc-pagination .pg-info { color: var(--text-secondary); margin-right: auto; }
.gc-page-btn     { width: 32px; height: 32px; border: 1px solid var(--border-med); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; color: var(--text-secondary); transition: all 0.12s; }
.gc-page-btn:hover { border-color: var(--navy); color: var(--navy); }
.gc-page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.gc-page-btn[rel] { text-decoration: none; }
.gc-page-ellipsis { padding: 0 2px; color: var(--text-muted); user-select: none; }

/* ── Portal (client facing) ── */
.gc-portal-header { background: var(--navy); height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; }
.gc-portal-body   { background: var(--bg); min-height: calc(100vh - 58px); padding: 28px 32px; }
.gc-portal-grid   { display: grid; grid-template-columns: 1fr 300px; gap: 20px; max-width: 1100px; margin: 0 auto; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .gc-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .gc-grid-sidebar, .gc-grid-sidebar-wide { grid-template-columns: 1fr; }
  .gc-portal-grid { grid-template-columns: 1fr; }
}
.gc-hamburger { display: none; }
.gc-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 95; }
.gc-sidebar-overlay.open { display: block; }
.gc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 768px) {
  .gc-sidebar { transform: translateX(-100%); transition: transform 0.3s; z-index: 100; }
  .gc-sidebar.open { transform: translateX(0); }
  .gc-content-wrap { margin-left: 0; min-width: 0; }
  .gc-stats-grid { grid-template-columns: 1fr 1fr; }
  .gc-grid-2, .gc-grid-3 { grid-template-columns: 1fr; }
  .gc-hamburger { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg); cursor: pointer; color: var(--text-secondary); font-size: 18px; flex-shrink: 0; margin-right: 8px; }
}

/* ============================================================
   Mobile optimisation - makes the app usable on phones/tablets.
   The views use raw <table class="gc-table"> (no scroll wrapper) and lots of
   INLINE grid-template-columns, so these rules target those patterns globally
   rather than requiring every view to be edited.
   ============================================================ */

/* Never let a stray wide element push the whole page sideways. */
html, body { max-width: 100%; }

/* Grid/flex children default to min-width:auto (= min-content), which stops them
   shrinking and lets wide inner content (tables, long text) blow out the column.
   Allow the columns and cards to shrink so that inner content scrolls/wraps
   inside instead of pushing the page sideways. */
.gc-grid-sidebar > *, .gc-grid-sidebar-wide > *, .gc-portal-grid > *,
.gc-grid-2 > *, .gc-grid-3 > * { min-width: 0; }
.gc-card { min-width: 0; }

@media (max-width: 768px) {
  /* Tighter chrome so content gets the width. */
  .gc-page { padding: 14px; }
  .gc-topbar { padding: 0 14px; }
  .gc-card-body { padding: 14px; }

  /* Wide tables scroll horizontally inside their card instead of overflowing
     the viewport (display:block turns the table into a scroll container). */
  .gc-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  /* Page headers (title + action button) wrap instead of colliding. */
  .gc-page-header { flex-wrap: wrap; row-gap: 10px; }
  .gc-page-header > *:last-child { flex-shrink: 0; }
  /* …but never wider than the screen: a long title/subtitle, or a row of
     actions, wraps inside its own box instead of scrolling the page sideways. */
  .gc-page-header > * { min-width: 0; max-width: 100%; }

  /* Filters stack full-width. */
  .gc-filters { gap: 8px; }
  .gc-filter-input, .gc-filter-select { min-width: 0; flex: 1 1 140px; }

  /* Tabs scroll rather than wrapping into an unreadable stack. */
  .gc-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .gc-tab { flex-shrink: 0; }

  /* Modals fit the screen. */
  .gc-modal { max-width: calc(100vw - 32px); }
}

/* Phones: collapse inline multi-column grids to a single column. This is the
   big one - most detail/form/report views lay out with an inline
   `grid-template-columns: 1fr 1fr[ 1fr]`, which otherwise overflows. Scoped to
   page content so the sidebar/topbar are unaffected. */
@media (max-width: 680px) {
  .gc-page [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .gc-stats-grid { grid-template-columns: 1fr 1fr; }
  /* Buttons in a row wrap instead of overflowing. */
  .gc-page-header [style*="display:flex"], .gc-card-body [style*="display:flex"] { flex-wrap: wrap; }
}

/* Collapsible list-page filters (app.js initFilterCollapse). Desktop: the
   toggle is hidden and every filter shows. Phones: the main search box, the
   Search/Clear buttons and a "Filters (n active)" toggle stay visible; the rest
   fold away until the toggle is tapped. Collapsed controls are display:none,
   which still submits their values, so Enter-to-search keeps every filter. */
.gc-filters-toggle { display: none; }
.gc-filters-toggle .gc-filters-count { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: var(--navy); font-size: 11px; font-weight: 700; text-align: center; }
.gc-filters-toggle .ti-chevron-down { transition: transform .15s; }
.gc-fc-open > .gc-filters-toggle .ti-chevron-down { transform: rotate(180deg); }
@media (max-width: 640px) {
  .gc-fc > .gc-filters-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .gc-fc:not(.gc-fc-open) > .gc-fc-item { display: none !important; }
  .gc-fc > .gc-fc-search { flex: 1 1 100% !important; min-width: 0; }
}

/* Small phones. */
@media (max-width: 460px) {
  .gc-stats-grid { grid-template-columns: 1fr; }
  .gc-page-title { font-size: 18px; }
  .gc-btn { padding: 0 14px; }
}

/* ============================================================
   Shell v6 - top-bar search, notifications dropdown, flash/toasts,
   accessibility helpers, reusable row lists (dashboard) and search page.
   ============================================================ */

/* Accessibility helpers */
.gc-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gc-skip-link { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--radius-md); font-size: 13px; }
.gc-skip-link:focus { top: 8px; }
.gc-page:focus { outline: none; }
kbd { display: inline-block; font-family: inherit; font-size: 11px; line-height: 1; padding: 3px 6px; border: 1px solid var(--border-med); border-bottom-width: 2px; border-radius: 4px; background: #fff; color: var(--text-secondary); }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:not(.gc-page):focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Top bar layout: title never wraps under the hamburger - it truncates. */
.gc-topbar { gap: 12px; }
.gc-topbar-left { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; }
.gc-topbar-titles { min-width: 0; }
.gc-topbar-left .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.gc-topbar-left .page-breadcrumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-topbar-right { flex-shrink: 0; gap: 8px; }
a.gc-topbar-btn { text-decoration: none; }
.gc-topbar-btn-primary { white-space: nowrap; text-decoration: none; }
.gc-nav-badge.warn { background: #EF9F27; color: #1e2235; }
.gc-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notification bell badge: a real count pill (it used to be a 7px dot with the
   number overflowing out of it). */
.gc-notif-badge { width: auto; height: auto; min-width: 16px; padding: 1px 4px; top: -5px; right: -5px; font-size: 10px; line-height: 12px; font-weight: 500; text-align: center; color: var(--navy); border-radius: 10px; }
.gc-notif-badge[hidden] { display: none !important; }

/* Global search */
.gc-search { position: relative; flex: 1 1 420px; max-width: 520px; display: flex; align-items: center; margin: 0 auto; }
.gc-search-icon { position: absolute; left: 11px; font-size: 16px; color: var(--text-muted); pointer-events: none; }
.gc-search-input { width: 100%; height: 36px; padding: 0 34px 0 34px; border: 1px solid var(--border-med); border-radius: var(--radius-md); background: var(--bg); font-size: 13px; font-family: 'DM Sans', sans-serif; color: var(--text-primary); outline: none; transition: border-color 0.15s, background 0.15s; -webkit-appearance: none; appearance: none; }
.gc-search-input:focus { border-color: var(--green); background: #fff; }
.gc-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.gc-search-kbd { position: absolute; right: 9px; pointer-events: none; }
.gc-search-input:focus ~ .gc-search-kbd { display: none; }
.gc-search-close { display: none; }
.gc-search-toggle { display: none; }
.gc-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 560px); overflow-y: auto; background: #fff; border: 1px solid var(--border-med); border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(30,34,53,0.16); z-index: 120; padding: 6px 0; }
.gc-search-results[hidden] { display: none; }
.gc-sr-group + .gc-sr-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.gc-sr-group-label { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); padding: 8px 14px 4px; }
.gc-sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; color: var(--text-primary); text-decoration: none; cursor: pointer; }
.gc-sr-item:hover, .gc-sr-item[aria-selected="true"] { background: var(--green-light); }
.gc-sr-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gc-sr-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-sr-sub { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-sr-badges { display: flex; gap: 4px; flex-shrink: 0; }
.gc-sr-all { border-top: 1px solid var(--border); margin-top: 4px; color: var(--green-text); font-weight: 500; }
.gc-sr-empty { padding: 14px; font-size: 13px; color: var(--text-secondary); }

/* Notifications dropdown */
.gc-notif-wrap { position: relative; }
.gc-notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid var(--border-med); border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(30,34,53,0.16); z-index: 120; overflow: hidden; }
.gc-notif-panel[hidden] { display: none; }
.gc-notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.gc-link-btn { background: none; border: none; color: var(--green-text); font-size: 12px; cursor: pointer; font-family: inherit; padding: 2px 4px; }
.gc-link-btn:hover { text-decoration: underline; }
.gc-notif-list { max-height: 60vh; overflow-y: auto; }
.gc-notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text-primary); }
.gc-notif-item:hover { background: #fafbfc; }
.gc-notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-med); flex-shrink: 0; margin-top: 5px; }
.gc-notif-item.unread { background: #fafff5; }
.gc-notif-item.unread .gc-notif-dot { background: var(--green); }
.gc-notif-text { display: flex; flex-direction: column; min-width: 0; }
.gc-notif-title { font-size: 13px; font-weight: 500; }
.gc-notif-msg { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.gc-notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.gc-notif-foot { display: block; text-align: center; padding: 10px; font-size: 12px; color: var(--green-text); font-weight: 500; }

/* Flash messages + toasts: dismissible; success/info fade, errors stay */
.gc-flash { position: relative; transition: opacity 0.3s, transform 0.3s; }
.gc-flash-text { flex: 1; min-width: 0; }
.gc-flash-close { background: none; border: none; color: inherit; opacity: 0.6; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; margin-left: 8px; flex-shrink: 0; }
.gc-flash-close:hover { opacity: 1; }
.gc-flash-hiding { opacity: 0; transform: translateY(-4px); }
.gc-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.gc-toast { margin: 0; box-shadow: var(--shadow-md); }

/* Empty-state extras (say what to do next) */
.gc-empty-hint { font-size: 12px !important; margin-top: 6px; color: var(--text-muted); }
.gc-empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.gc-empty-actions .gc-btn { text-decoration: none; }

/* Reusable compact row list (dashboard cards) - flex rows that truncate text
   instead of scrolling sideways like a table does on a phone. */
.gc-rows { list-style: none; margin: 0; padding: 0; }
.gc-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); color: var(--text-primary); text-decoration: none; }
.gc-rows > li:last-child > .gc-row, .gc-rows > li:last-child.gc-row { border-bottom: none; }
a.gc-row:hover { background: #fafbfc; }
.gc-row-main { flex: 1; min-width: 0; }
.gc-row-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-row-sub { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-row-end { flex-shrink: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.gc-row-price { font-size: 13px; font-weight: 500; }
.gc-time-chip { background: var(--navy); color: var(--green); font-size: 11px; font-weight: 500; padding: 4px 8px; border-radius: 6px; text-align: center; min-width: 58px; flex-shrink: 0; }

/* Dashboard quick actions */
.gc-quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.gc-quick-action { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; font-size: 13px; font-weight: 500; color: var(--text-primary); text-decoration: none; transition: border-color 0.12s, box-shadow 0.12s; }
.gc-quick-action:hover { border-color: var(--green); box-shadow: 0 2px 10px rgba(30,34,53,0.08); }
.gc-quick-action i { width: 30px; height: 30px; border-radius: 8px; background: var(--green-light); color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

/* Task checkbox (dashboard + tasks list quick-complete) */
.gc-check { width: 20px; height: 20px; border-radius: 4px; border: 2px solid #bbb; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; color: var(--navy); font-size: 12px; transition: all 0.12s; }
.gc-check:hover { border-color: var(--green); background: var(--green-light); }
.gc-check.done { background: var(--green); border-color: var(--green); }
.gc-check[disabled] { opacity: 0.5; cursor: default; }

/* Segmented filter pills (tasks: Mine / All, Open / Overdue …) */
.gc-seg { display: inline-flex; border: 1px solid var(--border-med); border-radius: var(--radius-md); overflow: hidden; background: #fff; max-width: 100%; overflow-x: auto; }
.gc-seg a { padding: 0 12px; height: 34px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); text-decoration: none; border-right: 1px solid var(--border); white-space: nowrap; flex-shrink: 0; }
.gc-seg a:last-child { border-right: none; }
.gc-seg a:hover { color: var(--navy); background: var(--bg); }
.gc-seg a.active { background: var(--navy); color: #fff; }
.gc-seg .gc-seg-count { font-size: 10px; background: rgba(0,0,0,0.08); border-radius: 8px; padding: 1px 6px; }
.gc-seg a.active .gc-seg-count { background: rgba(255,255,255,0.2); }

/* Search results page */
.gc-search-page-form { position: relative; display: flex; gap: 10px; align-items: center; margin-bottom: 16px; max-width: 720px; }
.gc-search-page-form > i { position: absolute; left: 13px; top: 13px; color: var(--text-muted); font-size: 16px; }
.gc-search-page-form .gc-input { padding-left: 38px; }
.gc-search-summary { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.gc-search-sections { display: flex; flex-direction: column; gap: 16px; }
.gc-result-list { list-style: none; margin: 0; padding: 0; }
.gc-result { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text-primary); }
.gc-result-list li:last-child .gc-result { border-bottom: none; }
.gc-result:hover { background: #fafbfc; }
.gc-result-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gc-result-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-result-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-result-badges { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 1100px) {
  .gc-quick-actions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .gc-search { flex-basis: 260px; }
  .gc-search-kbd { display: none; }
}
@media (max-width: 768px) {
  .gc-topbar { gap: 8px; }
  .gc-topbar-left { flex: 1 1 auto; }
  .gc-topbar-left .page-title { max-width: none; font-size: 15px; }
  .gc-hamburger { margin-right: 10px; }
  .gc-hide-sm { display: none; }
  .gc-search-toggle { display: flex; }
  /* Search collapses to a magnifier; tapping it opens a full-width row over the top bar. */
  .gc-search { display: none; }
  body.gc-search-open .gc-search { display: flex; position: absolute; left: 0; right: 0; top: 0; height: var(--topbar-h); max-width: none; margin: 0; padding: 0 10px; background: #fff; z-index: 130; gap: 8px; }
  body.gc-search-open .gc-search-icon { left: 21px; }
  body.gc-search-open .gc-search-input { font-size: 16px; /* no iOS zoom-on-focus */ }
  body.gc-search-open .gc-search-close { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--text-secondary); font-size: 16px; flex-shrink: 0; cursor: pointer; }
  .gc-search-results { position: fixed; top: calc(var(--topbar-h) + 4px); left: 8px; right: 8px; max-height: calc(100vh - var(--topbar-h) - 16px); }
  .gc-notif-panel { position: fixed; top: calc(var(--topbar-h) + 4px); right: 8px; left: 8px; width: auto; max-width: none; }
  .gc-row { padding: 10px 14px; }
  #gcIdleWarning { white-space: normal !important; width: calc(100vw - 32px); }
  .gc-sidebar.open { box-shadow: 0 0 40px rgba(0,0,0,0.3); }
}
@media (max-width: 460px) {
  .gc-topbar-btn-primary { padding: 0 10px; }
  .gc-topbar-btn-label { display: none; }
  .gc-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .gc-stat-card { padding: 12px 14px; }
  .gc-stat-value { font-size: 22px; }
  .gc-quick-actions { gap: 8px; }
  .gc-quick-action { padding: 10px; font-size: 12px; gap: 8px; }
  .gc-result { padding: 10px 14px; }
  .gc-seg a { padding: 0 9px; }
}

/* Page headers + form sections used across ~50 views (were unstyled, so the
   h1 rendered at the browser default 32px and form section titles at h3 size). */
.gc-page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.gc-page-title { font-size: 20px; font-weight: 500; color: var(--text-primary); line-height: 1.25; }
.gc-page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.gc-form-section { font-size: 11px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; color: var(--navy); margin: 4px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.gc-required { color: #A32D2D; }
.gc-back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.gc-back-link:hover { color: var(--navy); }
.gc-btn { text-decoration: none; }
.gc-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.gc-select:focus { border-color: var(--green); }

/* Record picker (typeahead) - see app.js initTypeahead */
.gc-typeahead { position: relative; }
.gc-ta-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border-med); border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 50; max-height: 280px; overflow-y: auto; }
.gc-ta-list[hidden] { display: none; }
.gc-ta-item { display: flex; flex-direction: column; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.gc-ta-item:hover, .gc-ta-item[aria-selected="true"] { background: var(--green-light); }

/* Read-only (viewer) accounts: app.js hides add/edit links and save buttons
   with [hidden]; .gc-btn's own display would otherwise override it. */
body[data-readonly="1"] a[hidden],
body[data-readonly="1"] button[hidden],
body[data-readonly="1"] input[hidden] { display: none !important; }

/* ── Phone "card" layout for list tables ───────────────────────────────────
   On a phone a wide list table only showed its first column or two (amount,
   status and the Open/action buttons were off-screen to the right). A table
   with .gc-cards turns each row into a card: the first cell as the title, the
   rest as "LABEL value" lines. app.js fills each cell's data-label from the
   column header, so the views need only the class. */
@media (max-width: 640px) {
  .gc-table.gc-cards { display: block; white-space: normal; overflow: visible; }
  .gc-table.gc-cards thead { display: none; }
  .gc-table.gc-cards tbody { display: block; }
  .gc-table.gc-cards tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .gc-table.gc-cards td { display: block; position: relative; padding: 3px 0 3px 108px !important; border: 0 !important; white-space: normal; min-height: 22px; text-align: left !important; }
  .gc-table.gc-cards td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 100px; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
  .gc-table.gc-cards td:first-child { padding-left: 0 !important; padding-bottom: 6px !important; font-weight: 500; }
  .gc-table.gc-cards td:first-child::before, .gc-table.gc-cards td[data-label=""]::before { content: none; }
  .gc-table.gc-cards td[data-label=""] { padding-left: 0 !important; }
  .gc-table.gc-cards td[colspan] { padding-left: 0 !important; }
  .gc-table.gc-cards td[colspan]::before { content: none; }
  .gc-table-wrap:has(> .gc-cards) { overflow: visible; }
}

/* Upper-cased inputs (postcode) shouldn't shout their placeholder ("E.G. M20 2AB"). */
.gc-input::placeholder { text-transform: none; }

/* Laptop-height screens: the full sidebar (≈860px) pushed Management
   (Reports, Admin, Integrations, Branches) below the fold at 1366×900, and
   seven items at 1366×768. Tighten the spacing so it fits. */
@media (min-width: 769px) and (max-height: 960px) {
  .gc-nav a { padding-top: 5px; padding-bottom: 5px; }
  .gc-nav-section { padding: 7px 18px 2px; }
}
@media (min-width: 769px) and (max-height: 820px) {
  .gc-nav a { padding-top: 2px; padding-bottom: 2px; }
  .gc-nav-section { padding: 4px 18px 0; }
  .gc-sidebar-logo { padding: 10px 18px 8px; }
  .gc-sidebar-user { padding: 8px 18px; }
}

/* eSign recipient row on phones: the global one-column collapse turned the
   remove (×) button into a full-width red bar. Name + × on one line, email and
   role full width below. */
@media (max-width: 680px) {
  .gc-page .r-row[style*="grid-template-columns"] { grid-template-columns: 1fr auto !important; }
  .gc-page .r-row .rec-email, .gc-page .r-row select { grid-column: 1 / -1; }
  .gc-page .r-row .r-rm { grid-column: 2; grid-row: 1; }
}

/* Narrow phones: tab strips wrap onto a second line rather than hiding the
   last tabs off-screen with no hint that they scroll (Reports). */
@media (max-width: 480px) {
  .gc-tabs { flex-wrap: wrap; white-space: normal; overflow-x: visible; }
  .gc-tab { padding: 8px 12px; }
}
