/* ===== TOLET SOLUTIONS - LIGHT THEME ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  --bg: #f5f6fa; --bg-white: #ffffff; --bg-card: #ffffff; --bg-card-hover: #f8f9fc;
  --bg-input: #f0f2f7; --bg-sidebar: #fbfbfd;
  --accent: #2563eb; --accent-light: #dbeafe; --accent-hover: #1d4ed8;
  --green: #16a34a; --green-light: #dcfce7;
  --red: #dc2626; --red-light: #fee2e2;
  --orange: #ea580c; --orange-light: #fff7ed;
  --purple: #7c3aed; --purple-light: #ede9fe;
  --pink: #db2777; --pink-light: #fce7f3;
  --cyan: #0891b2; --cyan-light: #cffafe;
  --text: #1e293b; --text-secondary: #475569; --text-muted: #94a3b8;
  --border: #e2e8f0; --border-light: #f1f5f9;
  --radius: 10px; --radius-sm: 6px; --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06); --shadow: 0 2px 8px rgba(0,0,0,0.08); --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

html, body { height:100%; font-family:'Inter',system-ui,sans-serif; background:var(--bg); color:var(--text); overflow:hidden; -webkit-font-smoothing:antialiased; }

::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:3px; }

/* ===== SVG ICON BASE ===== */
.icon-svg { width:18px; height:18px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.icon-svg.sm { width:14px; height:14px; }
.icon-svg.lg { width:22px; height:22px; }

/* ===== LAYOUT ===== */
#app { display:flex; flex-direction:column; height:100vh; }

.app-header {
  display:flex; align-items:center; padding:0 24px; height:60px; min-height:60px;
  background:var(--bg-white); border-bottom:1px solid var(--border); z-index:100; gap:20px;
}
.logo { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.logo-icon { width:32px; height:32px; background:var(--accent); border-radius:8px; display:flex; align-items:center; justify-content:center; }
.logo-icon svg { width:20px; height:20px; stroke:white; fill:none; stroke-width:2; }
.logo h1 { font-size:17px; font-weight:800; color:var(--text); letter-spacing:-0.3px; }
.location-badge { font-size:11px; padding:3px 10px; background:var(--accent-light); color:var(--accent); border-radius:20px; font-weight:600; white-space:nowrap; }

.main-nav { display:flex; gap:2px; flex:1; justify-content:center; background:var(--bg); border-radius:var(--radius); padding:3px; }
.nav-tab {
  display:flex; align-items:center; gap:7px; padding:8px 22px; border:none; background:transparent;
  color:var(--text-secondary); font-family:inherit; font-size:13px; font-weight:500;
  border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); white-space:nowrap;
}
.nav-tab:hover { color:var(--text); background:rgba(255,255,255,0.7); }
.nav-tab.active { background:var(--bg-white); color:var(--accent); font-weight:600; box-shadow:var(--shadow-sm); }
.nav-tab .icon-svg { stroke:currentColor; }

.main-layout { display:flex; flex:1; overflow:hidden; }
.content-area { flex:1; overflow:hidden; display:flex; flex-direction:column; padding:20px 24px; gap:14px; }

/* ===== TABS ===== */
.tab-content { display:none; flex-direction:column; flex:1; overflow:hidden; gap:14px; animation:fadeIn 0.25s ease; }
.tab-content.active { display:flex; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

/* ===== FILTERS ===== */
.filters-bar {
  display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:12px 16px;
  background:var(--bg-white); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm);
}
.filter-group { display:flex; align-items:center; gap:6px; }
.filter-group label { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.6px; font-weight:700; white-space:nowrap; }

.search-input {
  display:flex; align-items:center; gap:8px; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:0 12px; flex:1; min-width:180px; max-width:300px; transition:var(--transition);
}
.search-input:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-light); }
.search-input .icon-svg { color:var(--text-muted); }
.search-input input { flex:1; border:none; background:transparent; color:var(--text); font-family:inherit; font-size:13px; padding:8px 0; outline:none; }
.search-input input::placeholder { color:var(--text-muted); }

select {
  padding:7px 30px 7px 10px; background:var(--bg-white); border:1px solid var(--border);
  border-radius:var(--radius-sm); color:var(--text); font-family:inherit; font-size:12px; outline:none;
  cursor:pointer; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 8px center; transition:var(--transition);
}
select:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-light); }

/* ===== BUTTONS ===== */
.btn {
  display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border:none;
  border-radius:var(--radius-sm); font-family:inherit; font-size:12px; font-weight:600;
  cursor:pointer; transition:var(--transition); white-space:nowrap;
}
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent-hover); transform:translateY(-1px); box-shadow:0 4px 12px rgba(37,99,235,0.3); }
.btn-secondary { background:var(--purple-light); color:var(--purple); }
.btn-secondary:hover { background:#ddd6fe; }
.btn-danger { background:var(--red-light); color:var(--red); }
.btn-danger:hover { background:#fecaca; }
.btn-ghost { background:transparent; color:var(--text-secondary); }
.btn-ghost:hover { background:var(--bg-input); color:var(--text); }
.btn-sm { padding:5px 10px; font-size:11px; }
.btn-icon {
  width:34px; height:34px; display:flex; align-items:center; justify-content:center;
  border:none; background:var(--bg-input); color:var(--text-secondary);
  border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition);
}
.btn-icon:hover { background:var(--border); color:var(--text); }

/* ===== CHIPS ===== */
.chip-group { display:flex; flex-wrap:wrap; gap:5px; }
.chip {
  padding:4px 11px; border:1px solid var(--border); border-radius:20px; background:var(--bg-white);
  color:var(--text-secondary); font-family:inherit; font-size:11px; font-weight:500;
  cursor:pointer; transition:var(--transition);
}
.chip:hover { border-color:var(--accent); color:var(--accent); }
.chip.active { background:var(--accent); color:#fff; border-color:var(--accent); }

/* ===== LIST & CARDS ===== */
.list-container { flex:1; overflow-y:auto; padding-right:4px; }
.list-header { display:flex; justify-content:space-between; align-items:center; }
.list-header h3 { font-size:13px; font-weight:700; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.5px; }
.list-count { font-size:11px; color:var(--text-muted); background:var(--bg-input); padding:3px 10px; border-radius:20px; font-weight:600; }

.card {
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px 16px; margin-bottom:8px; cursor:pointer; transition:var(--transition); box-shadow:var(--shadow-sm);
}
.card:hover { border-color:var(--accent); box-shadow:var(--shadow); transform:translateY(-1px); }

.card-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:10px; }
.card-title { font-size:14px; font-weight:700; color:var(--text); }
.card-subtitle { font-size:11px; color:var(--text-muted); margin-top:2px; }

.card-badges { display:flex; gap:5px; flex-wrap:wrap; align-items:center; }
.badge { padding:3px 8px; border-radius:4px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.3px; display:inline-flex; align-items:center; gap:3px; }
.badge-plot { background:var(--orange-light); color:var(--orange); }
.badge-floor { background:var(--accent-light); color:var(--accent); }
.badge-house { background:var(--green-light); color:var(--green); }
.badge-apartment { background:var(--pink-light); color:var(--pink); }
.badge-independent { background:var(--cyan-light); color:var(--cyan); }

.badge-flag { padding:3px 8px; border-radius:4px; font-size:10px; font-weight:600; display:inline-flex; align-items:center; gap:3px; }
.badge-flag.on { background:var(--green-light); color:var(--green); }
.badge-flag.off { background:var(--bg-input); color:var(--text-muted); text-decoration:line-through; opacity:0.6; }
.badge-flag .flag-icon { width:12px; height:12px; }

.card-body { display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:6px 12px; }
.card-field { display:flex; flex-direction:column; gap:1px; }
.card-field .label { font-size:9px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:700; }
.card-field .value { font-size:13px; font-weight:500; color:var(--text); }
.card-field .value.highlight { color:var(--accent); font-weight:700; }

.card-footer { display:flex; justify-content:space-between; align-items:center; margin-top:10px; padding-top:8px; border-top:1px solid var(--border-light); }
.card-actions { display:flex; gap:4px; }
.card-date { font-size:10px; color:var(--text-muted); display:flex; align-items:center; gap:4px; }
.card-date .icon-svg { width:12px; height:12px; }

.dealer-tag { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; background:var(--purple-light); border-radius:4px; font-size:11px; color:var(--purple); font-weight:500; margin-right:4px; margin-top:3px; }

/* ===== SECTION DIVIDER ===== */
.section-divider { display:flex; align-items:center; gap:12px; margin:12px 0 6px; }
.section-divider .line { flex:1; height:1px; background:var(--border); }
.section-divider .title { font-size:12px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:1px; display:flex; align-items:center; gap:6px; }

/* ===== CALENDAR SIDEBAR (always open) ===== */
.calendar-sidebar {
  width:320px; min-width:320px; overflow-y:auto; background:var(--bg-sidebar);
  border-left:1px solid var(--border); display:flex; flex-direction:column;
}
.sidebar-content { padding:16px; flex:1; }

.cal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.cal-header h3 { font-size:14px; font-weight:700; display:flex; align-items:center; gap:6px; }
.cal-nav { display:flex; gap:3px; }
.cal-nav button { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border:1px solid var(--border); background:var(--bg-white); color:var(--text-secondary); border-radius:6px; cursor:pointer; font-size:12px; transition:var(--transition); }
.cal-nav button:hover { background:var(--bg-input); border-color:var(--accent); color:var(--accent); }

.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:1px; margin-bottom:16px; text-align:center; }
.cal-day-label { font-size:10px; color:var(--text-muted); padding:4px; font-weight:700; }
.cal-day { padding:6px 2px; font-size:12px; border-radius:6px; cursor:pointer; color:var(--text-secondary); transition:var(--transition); font-weight:500; }
.cal-day:hover { background:var(--accent-light); color:var(--accent); }
.cal-day.today { background:var(--accent); color:#fff; font-weight:700; }
.cal-day.has-events { position:relative; font-weight:700; color:var(--text); }
.cal-day.has-events::after { content:''; position:absolute; bottom:1px; left:50%; transform:translateX(-50%); width:4px; height:4px; background:var(--accent); border-radius:50%; }
.cal-day.today.has-events::after { background:#fff; }
.cal-day.other-month { opacity:0.25; }

.cal-section { margin-bottom:14px; }
.cal-section-title { font-size:10px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; margin-bottom:6px; display:flex; align-items:center; gap:6px; }

.cal-event {
  display:flex; gap:8px; padding:8px 10px; background:var(--bg-white); border:1px solid var(--border);
  border-radius:var(--radius-sm); margin-bottom:4px; transition:var(--transition); cursor:pointer;
}
.cal-event:hover { border-color:var(--accent); box-shadow:var(--shadow-sm); }
.cal-event-dot { width:3px; border-radius:2px; flex-shrink:0; }
.cal-event-dot.show_house { background:var(--purple); }
.cal-event-dot.payment_received { background:var(--green); }
.cal-event-dot.token_money { background:var(--orange); }
.cal-event-dot.follow_up { background:var(--cyan); }
.cal-event-dot.meeting { background:var(--pink); }
.cal-event-dot.other { background:var(--text-muted); }
.cal-event-info { flex:1; min-width:0; }
.cal-event-title { font-size:12px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--text); }
.cal-event-meta { font-size:10px; color:var(--text-muted); margin-top:1px; }
.cal-event-amount { font-size:12px; font-weight:700; color:var(--green); }
.cal-event.completed .cal-event-title { text-decoration:line-through; color:var(--text-muted); }

.cal-quick-add { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.cal-preset {
  padding:5px 10px; border:1px solid var(--border); border-radius:6px; background:var(--bg-white);
  color:var(--text-secondary); font-family:inherit; font-size:11px; cursor:pointer; transition:var(--transition);
  display:flex; align-items:center; gap:4px; font-weight:500;
}
.cal-preset:hover { border-color:var(--accent); color:var(--accent); background:var(--accent-light); }

/* ===== MODAL ===== */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.3); backdrop-filter:blur(4px);
  display:none; align-items:center; justify-content:center; z-index:1000;
}
.modal-overlay.active { display:flex; }
.modal {
  background:var(--bg-white); border:1px solid var(--border); border-radius:var(--radius-lg);
  width:92%; max-width:660px; max-height:85vh; display:flex; flex-direction:column;
  box-shadow:var(--shadow-lg); animation:scaleIn 0.2s ease;
}
@keyframes scaleIn { from{opacity:0;transform:scale(0.96)} to{opacity:1;transform:scale(1)} }
.modal-header { display:flex; justify-content:space-between; align-items:center; padding:16px 20px; border-bottom:1px solid var(--border); }
.modal-header h2 { font-size:15px; font-weight:700; }
.modal-body { padding:20px; overflow-y:auto; flex:1; }
.modal-footer { display:flex; justify-content:flex-end; gap:8px; padding:12px 20px; border-top:1px solid var(--border); background:var(--bg); border-radius:0 0 var(--radius-lg) var(--radius-lg); }

/* ===== FORMS ===== */
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-grid .full-width { grid-column:1/-1; }
.form-group { display:flex; flex-direction:column; gap:4px; }
.form-group label { font-size:10px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; }
.form-group input, .form-group select, .form-group textarea {
  padding:8px 12px; background:var(--bg-white); border:1px solid var(--border);
  border-radius:var(--radius-sm); color:var(--text); font-family:inherit;
  font-size:13px; outline:none; transition:var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-light); }
.form-group textarea { resize:vertical; min-height:56px; }
.form-row { display:flex; gap:8px; }

.quick-select { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
.quick-select .qs-btn {
  padding:4px 9px; border:1px solid var(--border); border-radius:5px; background:var(--bg-white);
  color:var(--text-secondary); font-family:inherit; font-size:11px; cursor:pointer; transition:var(--transition); font-weight:500;
}
.quick-select .qs-btn:hover { border-color:var(--accent); color:var(--accent); }
.quick-select .qs-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }

.toggle-group { display:flex; gap:4px; }
.toggle-btn {
  padding:7px 14px; border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--bg-white); color:var(--text-secondary); font-family:inherit; font-size:12px;
  cursor:pointer; transition:var(--transition); font-weight:500;
}
.toggle-btn:hover { border-color:var(--accent); color:var(--accent); }
.toggle-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600; }

.switch-wrapper { display:flex; align-items:center; gap:8px; padding-top:4px; }
.switch {
  position:relative; width:38px; height:20px; background:var(--bg-input); border:1px solid var(--border);
  border-radius:10px; cursor:pointer; transition:var(--transition);
}
.switch.on { background:var(--accent); border-color:var(--accent); }
.switch .knob { position:absolute; top:2px; left:2px; width:14px; height:14px; background:#fff; border-radius:50%; transition:var(--transition); box-shadow:var(--shadow-sm); }
.switch.on .knob { left:20px; }
.switch-label { font-size:12px; color:var(--text-secondary); font-weight:500; }

.dealer-section { padding:10px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); margin-top:4px; }
.dealer-entry { display:grid; grid-template-columns:1fr 1fr auto; gap:6px; align-items:end; margin-bottom:6px; }
.dealer-entry input { padding:6px 10px; background:var(--bg-white); border:1px solid var(--border); border-radius:5px; color:var(--text); font-family:inherit; font-size:12px; outline:none; }
.dealer-entry input:focus { border-color:var(--accent); }

/* ===== EMPTY STATE ===== */
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:40px; color:var(--text-muted); gap:10px; }
.empty-state .icon-svg { width:48px; height:48px; opacity:0.3; stroke-width:1.5; }
.empty-state p { font-size:13px; }

/* ===== TOAST ===== */
.toast-container { position:fixed; bottom:20px; right:20px; z-index:2000; display:flex; flex-direction:column; gap:6px; }
.toast { padding:10px 18px; border-radius:var(--radius-sm); font-size:13px; font-weight:500; box-shadow:var(--shadow-lg); animation:slideIn 0.25s ease; }
@keyframes slideIn { from{opacity:0;transform:translateX(16px)} to{opacity:1;transform:translateX(0)} }
.toast-success { background:#065f46; color:#a7f3d0; }
.toast-error { background:#991b1b; color:#fca5a5; }
.toast-info { background:#1e3a5f; color:#93c5fd; }

/* ===== PERSON CARDS ===== */
.person-avatar { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; flex-shrink:0; }
.person-avatar.buyer { background:var(--purple-light); color:var(--purple); }
.person-avatar.tenant { background:var(--accent-light); color:var(--accent); }

@media (max-width:1100px) { .calendar-sidebar { width:280px; min-width:280px; } }
@media (max-width:900px) { .form-grid { grid-template-columns:1fr; } }
