/* ============================================================
   WillowRoo Client Portal — App Stylesheet
   Dark / Gold / Silver — matches main site palette
   ============================================================ */

:root {
  --gold:         #C9963A;
  --gold-light:   #E8B84B;
  --gold-dark:    #9A7028;
  --gold-muted:   rgba(201,150,58,.12);
  --silver:       #A8B8C4;
  --silver-light: #D0D8DF;
  --silver-muted: rgba(168,184,196,.1);

  --bg:        #080810;
  --surface:   #0D0D1A;
  --card:      #12121E;
  --card2:     #16162A;
  --border:    rgba(255,255,255,.06);
  --border-hi: rgba(201,150,58,.3);

  --text:      #EEEEF8;
  --text-2:    #9090B0;
  --text-3:    #555570;

  --danger:  #E57373;
  --success: #66BB6A;
  --warn:    #FFA726;
  --info:    #42A5F5;

  --sidebar-w: 220px;
  --top-h:     56px;
  --radius:    10px;
  --trans:     .25s cubic-bezier(.4,0,.2,1);
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:15px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

h1,h2,h3,h4,h5 { font-family:'Exo 2',sans-serif; font-weight:700; line-height:1.2; }

/* ===== LAYOUT ===== */
.portal-body { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: transform var(--trans);
  z-index: 200;
}

.sidebar-header {
  padding: 1.1rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}

.sidebar-logo-mark { width: 32px; height: 32px; flex-shrink: 0; }

.sidebar-logo-text { line-height: 1; }
.sidebar-logo-text .name {
  font-family: 'Exo 2', sans-serif;
  font-size: .95rem;
  font-weight: 800;
}
.sidebar-logo-text .sub {
  font-family: 'Exo 2', sans-serif;
  font-size: .52rem;
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--text-3);
  display: block;
  margin-top: 1px;
}

.sidebar-section-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 1.1rem 1rem .4rem;
}

.sidebar-nav { flex: 1; padding: .5rem 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 1rem;
  border-radius: 8px;
  margin: 1px .5rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--trans);
  position: relative;
  border: 1px solid transparent;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--gold-muted); color: var(--text); }
.nav-item.active {
  background: var(--gold-muted);
  color: var(--gold);
  border-color: var(--border-hi);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #080810;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 100px;
  padding: .05rem .4rem;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}

.user-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  overflow: hidden;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold-muted);
  border: 1px solid var(--gold-dark);
  color: var(--gold);
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--danger); background: rgba(229,115,115,.08); }
.logout-btn svg { width: 14px; height: 14px; }

/* ===== MAIN AREA ===== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  flex-shrink: 0;
}

.topbar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  color: var(--text-2);
}
.topbar-toggle span { display:block; width:18px; height:1.5px; background:currentColor; border-radius:2px; }

.topbar-title {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

/* ===== CONTENT AREA ===== */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.portal-section { display: none; }
.portal-section.active { display: block; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: var(--trans);
}
.stat-card:hover { border-color: var(--border-hi); }

.stat-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: .5rem;
}

.stat-value {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.stat-sub {
  font-size: .75rem;
  color: var(--text-3);
  margin-top: .3rem;
}

/* ===== SECTION HEADER ===== */
.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.sec-header h2 { font-size: 1.05rem; color: var(--text); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 7px;
  font-family: 'Exo 2', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #080810;
}
.btn-gold:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold-dark);
}
.btn-outline:hover { background: var(--gold-muted); border-color: var(--gold); }

.btn-ghost {
  background: var(--card);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hi); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(229,115,115,.3);
}
.btn-danger:hover { background: rgba(229,115,115,.08); }

.btn-sm { padding: .35rem .75rem; font-size: .75rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card:hover { border-color: var(--border-hi); }

.card-title {
  font-family: 'Exo 2', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .9rem;
}

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
}
td {
  padding: .75rem 1rem;
  font-size: .85rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.015); color: var(--text); }
tbody { background: var(--card); }

.td-name { color: var(--text); font-weight: 600; }
.td-gold { color: var(--gold); font-family:'Exo 2',sans-serif; font-weight:700; }
.td-actions { display: flex; gap: .4rem; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 100px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge--green  { background: rgba(102,187,106,.12); color: #66BB6A; border: 1px solid rgba(102,187,106,.25); }
.badge--yellow { background: rgba(255,167,38,.12);  color: #FFA726; border: 1px solid rgba(255,167,38,.25); }
.badge--red    { background: rgba(229,115,115,.12); color: #E57373; border: 1px solid rgba(229,115,115,.25); }
.badge--blue   { background: rgba(66,165,245,.12);  color: #42A5F5; border: 1px solid rgba(66,165,245,.25); }
.badge--gray   { background: rgba(255,255,255,.06); color: var(--text-3); border: 1px solid var(--border); }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-label { font-size: .75rem; font-weight: 600; color: var(--text-2); letter-spacing: .04em; }
.form-label .req { color: var(--gold); }

.form-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .6rem .9rem;
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: var(--trans);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(201,150,58,.1); }
.form-control::placeholder { color: var(--text-3); }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 5 5-5' stroke='%23555570' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
select.form-control option { background: var(--card2); }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-stack { display: flex; flex-direction: column; gap: .9rem; }
.form-error { font-size: .75rem; color: var(--danger); display: none; }
.form-error.show { display: block; }

/* ===== SEARCH ===== */
.search-wrap { position: relative; }
.search-wrap svg { position:absolute; left:.7rem; top:50%; transform:translateY(-50%); width:14px; height:14px; color:var(--text-3); pointer-events:none; }
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .5rem .9rem .5rem 2.2rem;
  color: var(--text);
  font-size: .85rem;
  outline: none;
  width: 220px;
  transition: var(--trans);
}
.search-input:focus { border-color: var(--border-hi); width: 280px; }

/* ===== CLIENTS GRID ===== */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.client-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--trans);
  position: relative;
}
.client-card:hover { border-color: var(--border-hi); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.3); }

.client-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.client-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gold-muted);
  border: 1px solid var(--gold-dark);
  color: var(--gold);
  font-family: 'Exo 2', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.client-card-name { font-weight: 700; font-size: .95rem; color: var(--text); }
.client-card-company { font-size: .78rem; color: var(--text-3); }

.client-card-stats { display: flex; gap: 1rem; }
.client-stat { flex: 1; }
.client-stat-label { font-size: .65rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.client-stat-val { font-family:'Exo 2',sans-serif; font-weight:700; font-size:.9rem; color:var(--text); margin-top:.15rem; }
.client-stat-val.gold { color: var(--gold); }
.client-stat-val.warn { color: var(--warn); }
.client-stat-val.danger { color: var(--danger); }

/* ===== CLIENT DETAIL ===== */
.detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.detail-back { color: var(--text-2); display: flex; align-items: center; gap: .3rem; font-size: .85rem; cursor:pointer; }
.detail-back:hover { color: var(--gold); }
.detail-back svg { width: 14px; height: 14px; }

.detail-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--gold-muted); border: 1px solid var(--gold-dark);
  color: var(--gold); font-family:'Exo 2',sans-serif;
  font-weight: 800; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
}

.detail-meta h2 { font-size: 1.15rem; color: var(--text); }
.detail-meta p { font-size: .83rem; color: var(--text-3); margin-top:.2rem; }

.detail-actions { margin-left: auto; display: flex; gap: .5rem; }

.balance-hero {
  background: linear-gradient(135deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.balance-amount { font-family:'Exo 2',sans-serif; font-size: 2.8rem; font-weight: 800; color: var(--gold); line-height: 1; }
.balance-label { font-size: .72rem; font-weight: 700; letter-spacing:.12em; text-transform:uppercase; color:var(--text-3); margin-bottom:.25rem; }
.balance-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap:wrap; }

/* ===== TABS ===== */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.tab-btn {
  padding: .6rem 1.1rem;
  font-family:'Exo 2',sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--trans);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== MESSAGES / CHAT ===== */
.message-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  height: calc(100vh - var(--top-h) - 3rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.convo-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.convo-list-header {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: 'Exo 2', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.convo-item {
  display: flex;
  flex-direction: column;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--trans);
}
.convo-item:hover, .convo-item.active { background: var(--gold-muted); }
.convo-item.active { border-left: 2px solid var(--gold); }
.convo-name { font-weight: 600; font-size: .85rem; color: var(--text); }
.convo-project { font-size: .73rem; color: var(--text-3); margin-top: .15rem; }
.convo-preview { font-size: .75rem; color: var(--text-3); margin-top:.2rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.chat-area { display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.chat-header-name { font-weight: 700; font-size: .9rem; color: var(--text); }
.chat-header-sub { font-size: .75rem; color: var(--text-3); }

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: .85rem;
  gap: .5rem;
}
.chat-empty svg { width: 32px; height: 32px; opacity: .3; }

.msg-row {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.msg-row.mine { align-items: flex-end; }
.msg-row.theirs { align-items: flex-start; }

.msg-bubble {
  max-width: 72%;
  padding: .6rem .9rem;
  border-radius: 14px;
  font-size: .875rem;
  line-height: 1.5;
  word-break: break-word;
}
.mine .msg-bubble {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #080810;
  border-bottom-right-radius: 4px;
}
.theirs .msg-bubble {
  background: var(--card2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-meta { font-size: .65rem; color: var(--text-3); }
.msg-sender { font-weight: 600; }

.msg-attachment {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  margin-top: .3rem;
  font-size: .8rem;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--trans);
  max-width: 72%;
}
.msg-attachment:hover { background: rgba(255,255,255,.09); color: var(--gold); }
.msg-attachment svg { width: 14px; height: 14px; flex-shrink: 0; }

.msg-img {
  max-width: 260px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: .3rem;
}

.chat-compose {
  border-top: 1px solid var(--border);
  padding: .75rem 1rem;
  background: var(--surface);
}

.compose-row {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
}

.compose-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .9rem;
  color: var(--text);
  font-size: .875rem;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 40px;
  transition: var(--trans);
  line-height: 1.5;
}
.compose-input:focus { border-color: var(--border-hi); }
.compose-input::placeholder { color: var(--text-3); }

.compose-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #080810;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--trans);
}
.compose-btn:hover { filter: brightness(1.1); transform: scale(1.05); }
.compose-btn svg { width: 16px; height: 16px; }

.compose-attach {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
}
.compose-attach:hover { color: var(--gold); background: var(--gold-muted); }
.compose-attach svg { width: 16px; height: 16px; }
.compose-attach input { display: none; }

.compose-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .5rem;
}
.compose-file-chip {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .75rem;
  color: var(--text-2);
}
.compose-file-chip button { color: var(--text-3); font-size: .85rem; line-height:1; padding: 0 .1rem; }
.compose-file-chip button:hover { color: var(--danger); }

/* ===== FILES GRID ===== */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.file-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--trans);
}
.file-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }

.file-thumb {
  height: 110px;
  background: var(--card2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }

.file-info { padding: .6rem .75rem; }
.file-name { font-size: .8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: .7rem; color: var(--text-3); margin-top: .15rem; }

/* ===== INVOICE CARDS ===== */
.invoice-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.invoice-num { font-family:'Exo 2',sans-serif; font-weight:700; font-size:.85rem; color:var(--gold); }

/* ===== FINANCE / LEDGER ===== */
.ledger-row { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: none; }
.ledger-desc { font-size: .85rem; color: var(--text); }
.ledger-sub { font-size: .72rem; color: var(--text-3); margin-top: .1rem; }
.ledger-amount { font-family:'Exo 2',sans-serif; font-weight:700; font-size:.95rem; }
.ledger-amount.pos { color: var(--success); }
.ledger-amount.neg { color: var(--danger); }

/* ===== BALANCE DISPLAY ===== */
.balance-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.balance-big {
  font-family: 'Exo 2', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.balance-title { font-size: .78rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--text-3); margin-bottom: .75rem; }
.balance-note { font-size: .8rem; color: var(--text-3); margin-top: .75rem; }

/* ===== REFILL / AUTO-PAY ===== */
.refill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.refill-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.refill-title { font-family:'Exo 2',sans-serif; font-weight: 700; font-size: .95rem; color: var(--text); }
.refill-coming {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-muted);
  border: 1px solid rgba(201,150,58,.25);
  border-radius: 100px;
  padding: .2rem .7rem;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: var(--trans);
  cursor: pointer;
}
.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: var(--text-3);
  border-radius: 50%;
  transition: var(--trans);
}
.toggle-switch input:checked + .toggle-track { background: var(--gold); border-color: var(--gold); }
.toggle-switch input:checked + .toggle-track::after { left: calc(100% - 17px); background: #080810; }
.toggle-switch input:disabled + .toggle-track { opacity: .5; cursor: not-allowed; }

.refill-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: .75rem;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--trans);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--gold-dark);
  background: var(--gold-muted);
  color: var(--gold);
}
.upload-zone svg { width: 28px; height: 28px; margin: 0 auto .6rem; opacity: .5; }
.upload-zone p { font-size: .85rem; }
.upload-zone small { font-size: .75rem; margin-top: .25rem; display: block; }

/* ===== CHANGE REQUESTS ===== */
.change-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  transition: var(--trans);
}
.change-card:hover { border-color: var(--border-hi); }
.change-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .4rem; }
.change-title { font-weight: 700; font-size: .9rem; color: var(--text); flex: 1; }
.change-desc { font-size: .83rem; color: var(--text-2); margin-bottom: .6rem; }
.change-meta { font-size: .72rem; color: var(--text-3); display: flex; gap: 1rem; }

/* ===== RECEIPT PREVIEW ===== */
.receipt-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  color: var(--gold);
  padding: .2rem .5rem;
  border-radius: 5px;
  border: 1px solid rgba(201,150,58,.2);
  transition: var(--trans);
}
.receipt-link:hover { background: var(--gold-muted); }
.receipt-link svg { width: 12px; height: 12px; }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; color: var(--text); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.modal-close:hover { color: var(--danger); background: rgba(229,115,115,.08); }

.modal-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  padding: .7rem 1.1rem;
  border-radius: 9px;
  font-size: .85rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .3s, transform .3s;
  max-width: 320px;
  border-left: 3px solid transparent;
}
.toast--in { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--card2); border-left-color: var(--success); }
.toast--error   { background: var(--card2); border-left-color: var(--danger); }
.toast--info    { background: var(--card2); border-left-color: var(--info); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 1rem; opacity: .25; }
.empty-state p { font-size: .9rem; }
.empty-state .btn { margin-top: 1rem; }

/* ===== LOADING ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== LOGIN PAGE ===== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201,150,58,.07) 0%, transparent 70%), var(--bg);
  padding: 1rem;
  overflow: auto;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
}

.login-logo { display: flex; align-items: center; gap: .75rem; margin-bottom: 2rem; }
.login-logo svg { width: 40px; height: 40px; }
.login-logo .name { font-family:'Exo 2',sans-serif; font-size:1.2rem; font-weight:800; }
.login-logo .sub  { font-family:'Exo 2',sans-serif; font-size:.55rem; letter-spacing:.22em; color:var(--text-3); display:block; margin-top:1px; }

.login-heading { font-size: 1.3rem; color: var(--text); margin-bottom: .3rem; }
.login-sub { font-size: .875rem; color: var(--text-3); margin-bottom: 1.75rem; }

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.login-divider {
  text-align: center;
  font-size: .75rem;
  color: var(--text-3);
  margin: .5rem 0;
  position: relative;
}
.login-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.login-divider span { background: var(--card); padding: 0 .75rem; position: relative; }

.login-error {
  display: none;
  padding: .65rem .9rem;
  background: rgba(229,115,115,.08);
  border: 1px solid rgba(229,115,115,.25);
  border-radius: 7px;
  font-size: .83rem;
  color: var(--danger);
}
.login-error.show { display: block; }

.login-back {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .8rem;
  color: var(--text-3);
}
.login-back a { color: var(--gold); font-weight: 600; }
.login-back a:hover { text-decoration: underline; }

/* ===== OVERVIEW GRID ===== */
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1.25rem; }

.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  margin-top: .35rem;
}
.activity-text { font-size: .83rem; color: var(--text-2); flex: 1; }
.activity-text strong { color: var(--text); }
.activity-time { font-size: .72rem; color: var(--text-3); flex-shrink: 0; margin-top: .2rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 300;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.4); }
  .topbar-toggle { display: flex; }
  .overview-grid { grid-template-columns: 1fr; }
  .message-layout { grid-template-columns: 1fr; }
  .convo-list { display: none; }
  .convo-list.open { display: block; position: absolute; inset: 0; z-index: 10; background: var(--card); }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .refill-field-row { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: 1fr; }
  .detail-actions { flex-wrap: wrap; }
  .balance-hero { flex-direction: column; gap: 1rem; }
  .balance-actions { margin-left: 0; }
}
