/* Admin SPA — extra styles on top of /assets/app.css */

/* ===== GLOBAL FORM CONTROL DARK THEME — covers ALL native inputs/selects/textareas ===== */
input, select, textarea, button { font-family: inherit; font-size: 14px; color: var(--text); }
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="url"], input[type="date"],
input[type="datetime-local"], input[type="time"], input[type="month"], input[type="week"],
select, textarea {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 10px 12px; outline: none; width: 100%;
  box-sizing: border-box; -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23a3a8b8' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px; cursor: pointer;
}
select option, select optgroup { background: var(--bg-2); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: 0.7; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator { filter: invert(0.85); cursor: pointer; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
  caret-color: var(--text);
}

/* Filter bars (used on Leads, Payments, Tenants, etc.) */
.filters, .filter-bar, .toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 14px;
}
.filters input, .filters select, .filter-bar input, .filter-bar select,
.toolbar input, .toolbar select { width: auto; min-width: 140px; flex: 0 1 auto; }
.filters input[type="search"], .filter-bar input[type="search"] { min-width: 220px; flex: 1; }

.login-wrap { max-width: 380px; margin: 60px auto; padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 18px; font-size: 18px; text-align: center; }

.field { margin-bottom: 14px; }
.field label { display:block; font-size:12px; color: var(--text-dim); margin-bottom:6px; text-transform: uppercase; letter-spacing:.5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 80px; }

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border: none; color: #fff; font-weight:600; width: 100%; }
.btn-danger { background: var(--danger); border:none; color:#fff; }
.btn-success { background: var(--success); border:none; color:#fff; }
.btn-warning { background: var(--warning); border:none; color:#0b1020; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 13px; }

.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.muted { color: var(--text-dim); font-size: 13px; }
.small { font-size: 12px; }
.tag { display:inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight:600; background: var(--surface-2); color: var(--text-dim); text-transform: uppercase; letter-spacing:.5px; }
.tag.success { background: rgba(16,185,129,.15); color: var(--success); }
.tag.danger { background: rgba(239,68,68,.15); color: var(--danger); }
.tag.warning { background: rgba(245,158,11,.15); color: var(--warning); }
.tag.primary { background: rgba(99,102,241,.15); color: var(--primary-2); }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
table th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing:.5px; font-size: 11px; }
table tr:hover td { background: rgba(99,102,241,.04); }
table.compact th, table.compact td { padding: 6px 4px; }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-item { display:flex; align-items:center; gap:12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor:pointer; color: var(--text); background: var(--surface); }
.list-item:hover { background: rgba(99,102,241,.08); }
.list-item:last-child { border-bottom:none; }
.list-item .li-main { flex:1; min-width: 0; }
.list-item .li-title { font-weight:600; color: var(--text); font-size: 14px; }
.list-item .li-sub { color: var(--text-dim); font-size:12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-meta { color: var(--text-dim); font-size: 12px; text-align: right; white-space: nowrap; }
.list-item a, .list-item a:visited { color: var(--text); text-decoration: none; }

.toast-wrap { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 999; pointer-events:none; }
.toast { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; margin-top: 8px; box-shadow: var(--shadow); max-width: 90vw; font-size: 13px; pointer-events:auto; animation: toast-in .2s ease; }
.toast.success { border-color: var(--success); }
.toast.danger { border-color: var(--danger); }
@keyframes toast-in { from{ opacity:0; transform: translateY(10px);} to{opacity:1;transform:translateY(0);} }

.modal-backdrop { position: fixed; inset:0; background: rgba(0,0,0,.7); z-index: 200; display:flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 540px; width: 100%; max-height: 90vh; overflow:auto; box-shadow: var(--shadow); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display:flex; align-items:center; gap: 10px; }
.modal-header h3 { margin:0; flex:1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.empty { padding: 60px 20px; text-align: center; color: var(--text-dim); }
.empty .emoji { font-size: 48px; margin-bottom: 12px; opacity: .5; }

.tabs { display:flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--text-dim); border-bottom: 2px solid transparent; font-weight:500; white-space: nowrap; cursor: pointer; }
.tabs a.active { color: var(--primary-2); border-bottom-color: var(--primary-2); }

.badge-dot { display:inline-block; width: 8px; height:8px; border-radius:50%; background: var(--text-dim); margin-right: 4px; }
.badge-dot.success { background: var(--success); }
.badge-dot.danger { background: var(--danger); }
.badge-dot.warning { background: var(--warning); }

.usage-bar { height: 8px; background: var(--bg-2); border-radius: 100px; overflow: hidden; margin-top: 6px; }
.usage-bar > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .3s; }
.usage-bar.warn > div { background: var(--warning); }
.usage-bar.danger > div { background: var(--danger); }

.kbd { font-family: ui-monospace, monospace; background: var(--bg-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; border: 1px solid var(--border); }

pre.code { background: var(--bg-2); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; border: 1px solid var(--border); font-size: 12px; }

.impersonate-banner { background: linear-gradient(135deg, var(--warning), #f97316); color: #0b1020; padding: 10px 16px; text-align: center; font-weight: 600; position: sticky; top: 0; z-index: 100; }

@media (min-width: 700px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .row.responsive { flex-direction: row; }
}
