/* ── Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────────────── */
:root {
  --clr-text-muted:    var(--clr-muted);  /* alias — voorkomt zwarte tekst in dark theme */
  --clr-primary:       #D97706;
  --clr-primary-hover: #B45309;
  --clr-primary-light: #FEF3C7;
  --clr-success-light: #f0fdf4;
  --clr-warning-light: #fffbeb;
  --clr-bg:            #F7F7F6;
  --clr-surface:       #FFFFFF;
  --clr-surface-2:     #FAFAF8;
  --clr-text:          #18181A;
  --clr-muted:         #6F6F6D;
  --clr-border:        #E3E2E0;
  --clr-success:       #16A34A;
  --clr-warning:       #CA8A04;
  --clr-danger:        #DC2626;
  --clr-info:          #2563EB;
  --radius:            0.5rem;
  --radius-lg:         0.75rem;
  --shadow-sm:         0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow:            0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --sidebar-width:     240px;
  --nav-height:        56px; /* keep for inbox calc compat */
}

[data-theme="dark"] {
  --clr-bg:           #1C1917;
  --clr-surface:      #232220;
  --clr-surface-2:    #2D2B28;
  --clr-text:         #F0EDE8;
  --clr-muted:        #A09D98;
  --clr-border:       #3A3835;
  --clr-primary-light: #2D1E00;
  --clr-success-light: #052e16;
  --clr-warning-light: #422006;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.3);
  --shadow:           0 2px 8px rgba(0,0,0,.4);
}

[data-theme="dark"] .alert-success { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .alert-warning { background: #422006; color: #fcd34d; border-color: #92400e; }
[data-theme="dark"] .alert-error   { background: #450a0a; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .alert-info    { background: #1e3a5f; color: #93c5fd; border-color: #1d4ed8; }

[data-theme="dark"] .badge-green  { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-orange { background: #431407; color: #fb923c; }
[data-theme="dark"] .badge-blue   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-amber  { background: #422006; color: #fcd34d; }
[data-theme="dark"] .badge-yellow { background: #422006; color: #fcd34d; }
[data-theme="dark"] .badge-red    { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-teal   { background: #042f2e; color: #5eead4; }
[data-theme="dark"] .badge-purple { background: #2e1065; color: #c4b5fd; }

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; height: 100%; }
body {
  background: var(--clr-bg);
  color: var(--clr-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  min-height: 100%;
}

/* ── App shell (sidebar layout) ────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 1.1rem 1rem 1rem;
  font-weight: 700;
  font-size: .95rem;
  color: var(--clr-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.sidebar-brand-icon { font-size: 1.2rem; }

.sidebar-nav {
  flex: 1;
  padding: .6rem .6rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--clr-muted);
  padding: .7rem .5rem .3rem;
  opacity: .7;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .48rem .7rem;
  border-radius: var(--radius);
  color: var(--clr-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.sidebar-nav-link svg { flex-shrink: 0; opacity: .8; }
.sidebar-nav-link:hover {
  background: var(--clr-primary-light);
  color: var(--clr-primary-hover);
}
.sidebar-nav-link:hover svg { opacity: 1; }
.sidebar-nav-link.active {
  background: #292523;
  color: #F5F0E8;
  font-weight: 500;
}
.sidebar-nav-link.active svg { opacity: 1; }

[data-theme="dark"] .sidebar-nav-link.active {
  background: var(--clr-primary);
  color: #fff;
}

.sidebar-footer {
  padding: .6rem .5rem;
  border-top: 1px solid var(--clr-border);
  position: relative;
  flex-shrink: 0;
}
.sidebar-profile-btn {
  display: flex; align-items: center; gap: .55rem;
  width: 100%; background: none; border: none; cursor: pointer;
  padding: .4rem .5rem; border-radius: var(--radius);
  transition: background .12s; text-align: left;
}
.sidebar-profile-btn:hover { background: var(--clr-bg); }
.sidebar-profile-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--clr-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.sidebar-profile-info { flex: 1; min-width: 0; }
.sidebar-profile-name { font-size: .8rem; font-weight: 600; color: var(--clr-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile-role { font-size: .7rem; color: var(--clr-muted); }
.sidebar-profile-menu {
  position: absolute; bottom: calc(100% + .35rem); left: .5rem; right: .5rem;
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--radius); box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  z-index: 100; overflow: hidden;
}
.sidebar-profile-menu-info {
  padding: .55rem .75rem; border-bottom: 1px solid var(--clr-border);
}
.sidebar-profile-menu-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .75rem; font-size: .83rem; font-weight: 500;
  color: var(--clr-text); text-decoration: none;
  background: none; border: none; cursor: pointer; width: 100%;
  font-family: inherit; transition: background .1s;
}
.sidebar-profile-menu-item:hover { background: var(--clr-bg); }

/* ── Sidebar search ────────────────────────────────────────────────── */
.sidebar-search {
  position: relative;
  padding: .5rem .6rem .25rem;
}
.sidebar-search-input {
  width: 100%;
  font-size: .8rem;
  padding: .4rem .6rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  background: var(--clr-bg);
  color: var(--clr-text);
  outline: none;
  box-sizing: border-box;
}
.sidebar-search-input:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 2px var(--clr-primary-light);
}
.search-dropdown {
  position: absolute;
  left: .6rem;
  right: .6rem;
  top: calc(100% - .15rem);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  z-index: 200;
  max-height: 420px;
  overflow-y: auto;
}
.search-dropdown-section {
  padding: .4rem .75rem .2rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--clr-text-muted);
  background: var(--clr-bg);
  border-bottom: 1px solid var(--clr-border);
}
.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .75rem;
  text-decoration: none;
  color: var(--clr-text);
  font-size: .8rem;
  border-bottom: 1px solid var(--clr-border);
  transition: background .1s;
}
.search-dropdown-item:hover { background: var(--clr-primary-light); }
.search-dropdown-icon { flex-shrink: 0; font-size: .9rem; }
.search-dropdown-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-dropdown-tag {
  font-size: .7rem;
  padding: .1rem .35rem;
  border-radius: 3px;
  background: var(--clr-border);
  color: var(--clr-text-muted);
  flex-shrink: 0;
}
.search-dropdown-sub {
  font-size: .72rem;
  color: var(--clr-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.search-dropdown-all {
  display: block;
  padding: .45rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--clr-primary);
  text-decoration: none;
  text-align: center;
}
.search-dropdown-all:hover { background: var(--clr-primary-light); }
.search-dropdown-empty {
  padding: .6rem .75rem;
  font-size: .8rem;
  color: var(--clr-text-muted);
  text-align: center;
}

/* ── Main content area ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* Inbox needs full height - use :has() to opt main-content into overflow:hidden */
.main-content:has(.inbox) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Page layout ───────────────────────────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--clr-text); }
.page-sub { color: var(--clr-muted); font-size: .85rem; margin-top: .2rem; }

/* ── Inbox Layout ──────────────────────────────────────────────────── */
.inbox {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.inbox-sidebar {
  width: 340px; min-width: 280px;
  border-right: 1px solid var(--clr-border);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--clr-surface); flex-shrink: 0;
}
.inbox-sidebar-header {
  padding: 1rem; border-bottom: 1px solid var(--clr-border); background: var(--clr-surface);
}
.inbox-sidebar-header h2 { font-size: 1rem; font-weight: 700; margin-bottom: .6rem; }
.inbox-list { flex: 1; overflow-y: auto; }
.inbox-item {
  display: block; padding: .8rem 1rem; border-bottom: 1px solid var(--clr-border);
  cursor: pointer; text-decoration: none; color: var(--clr-text); transition: background 0.1s; position: relative;
}
.inbox-item:hover { background: var(--clr-bg); color: var(--clr-text); }
.inbox-item.active { background: var(--clr-primary-light); }
.inbox-item-unread { border-left: 3px solid var(--clr-primary); padding-left: calc(1rem - 3px); }
.inbox-item-row1 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .15rem; }
.inbox-item-sender { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.inbox-item-unread .inbox-item-sender { color: var(--clr-text); }
.inbox-item-time { font-size: .72rem; color: var(--clr-muted); flex-shrink: 0; margin-left: .5rem; }
.inbox-item-subject { font-size: .83rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .15rem; }
.inbox-item-unread .inbox-item-subject { font-weight: 600; }
.inbox-item-preview { font-size: .78rem; color: var(--clr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-panel { flex: 1; overflow-y: auto; background: var(--clr-bg); display: flex; flex-direction: column; }
.inbox-panel-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--clr-muted); gap: 1rem; font-size: .9rem; }
.inbox-panel-empty-icon { font-size: 2.5rem; opacity: .35; }
.inbox-panel-content { padding: 1.5rem; max-width: 820px; width: 100%; }

/* Thread messages */
.thread-message { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.thread-message-header { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; background: var(--clr-surface-2); border-bottom: 1px solid var(--clr-border); cursor: pointer; }
.thread-message-body { padding: 1rem; font-size: .875rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.thread-message.collapsed .thread-message-body { display: none; }

/* Reply composer */
.reply-composer { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--radius); margin-top: 1rem; overflow: hidden; }
.reply-composer-header { padding: .7rem 1rem; font-size: .83rem; font-weight: 600; background: var(--clr-surface-2); border-bottom: 1px solid var(--clr-border); color: var(--clr-muted); }
.reply-composer textarea { border: none; border-radius: 0; resize: vertical; min-height: 120px; border-bottom: 1px solid var(--clr-border); }
.reply-composer-actions { padding: .7rem 1rem; display: flex; gap: .5rem; align-items: center; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .9rem;
  color: var(--clr-text);
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .6;
}

/* ── Stats grid ────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .85rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-number { font-size: 1.9rem; font-weight: 800; color: var(--clr-primary); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--clr-muted); margin-top: .3rem; text-transform: uppercase; letter-spacing: .04em; }

/* ── Tables ────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  padding: .6rem 1rem;
  font-weight: 600;
  font-size: .72rem;
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--clr-surface-2);
  border-bottom: 1px solid var(--clr-border);
}
td { padding: .75rem 1rem; border-bottom: 1px solid var(--clr-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.table-row-link { cursor: pointer; }
.table-row-link:hover td { background: var(--clr-bg); }
.table-link { color: var(--clr-text); text-decoration: none; font-weight: 500; }
.table-link:hover { color: var(--clr-primary); }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge-amber  { background: #FDE68A; color: #92400E; }
.badge-orange { background: #FED7AA; color: #C2410C; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-green  { background: #DCFCE7; color: #15803D; }
.badge-red    { background: #FEE2E2; color: #B91C1C; }
.badge-gray   { background: var(--clr-surface-2); color: var(--clr-muted); border: 1px solid var(--clr-border); }
.badge-yellow { background: #FEF9C3; color: #A16207; }
.badge-teal   { background: #CCFBF1; color: #0F766E; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }

/* ── Round back button ─────────────────────────────────────────────── */
.btn-back-round {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  color: var(--clr-text); font-size: 1rem; text-decoration: none;
  flex-shrink: 0; transition: background .12s, border-color .12s, color .12s;
  line-height: 1;
}
.btn-back-round:hover {
  background: var(--clr-primary-light);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}
[data-theme="dark"] .btn-back-round { background: var(--clr-surface); }
[data-theme="dark"] .btn-back-round:hover { background: #292523; color: var(--clr-primary); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .48rem .95rem;
  border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all .12s; text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--clr-primary); color: #fff; }
.btn-primary:hover { background: var(--clr-primary-hover); color: #fff; }
.btn-success { background: var(--clr-success); color: #fff; }
.btn-success:hover { background: #15803D; color: #fff; }
.btn-outline { background: transparent; border-color: var(--clr-border); color: var(--clr-text); }
.btn-outline:hover { border-color: var(--clr-primary); color: var(--clr-primary); }
.btn-danger { background: var(--clr-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--clr-muted); }
.btn-ghost:hover { background: var(--clr-bg); color: var(--clr-text); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-xs { padding: .18rem .55rem; font-size: .73rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; font-weight: 600; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: .9rem; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--clr-muted); margin-bottom: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], select, textarea {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  background: var(--clr-surface); color: var(--clr-text);
  font-size: .875rem; transition: border-color .15s; outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-light);
}
textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Alert / Flash ─────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-error   { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.alert-info    { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }
.alert-warning { background: #FEF9C3; color: #A16207; border: 1px solid #FDE047; }

/* ── Mail content ──────────────────────────────────────────────────── */
.mail-body { font-size: .875rem; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.ai-box { background: var(--clr-surface-2); border: 1px solid var(--clr-border); border-left: 3px solid var(--clr-primary); border-radius: var(--radius); padding: 1rem; margin-top: 1rem; }
.ai-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--clr-primary); margin-bottom: .4rem; }
.reply-box { background: var(--clr-bg); border: 1px dashed var(--clr-border); border-radius: var(--radius); padding: 1rem; font-size: .875rem; line-height: 1.75; white-space: pre-wrap; position: relative; }

/* ── Timeline ──────────────────────────────────────────────────────── */
.timeline { list-style: none; position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: .5rem; top: 0; bottom: 0; width: 2px; background: var(--clr-border); }
.timeline-item { position: relative; margin-bottom: 1.1rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.1rem; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--clr-primary); border: 2px solid var(--clr-surface); }
.timeline-meta { font-size: .77rem; color: var(--clr-muted); margin-bottom: .2rem; }

/* ── Priority bar ──────────────────────────────────────────────────── */
.priority-bar { display: inline-block; height: 5px; border-radius: 3px; background: var(--clr-border); position: relative; width: 72px; vertical-align: middle; }
.priority-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 3px; background: var(--clr-primary); }

/* ── Lead value indicator ──────────────────────────────────────────── */
.lead-value { display: flex; align-items: center; gap: .4rem; }
.lead-value-bar { width: 48px; height: 4px; border-radius: 2px; background: var(--clr-border); }
.lead-value-fill { height: 100%; border-radius: 2px; background: var(--clr-primary); }

/* ── Funnel ────────────────────────────────────────────────────────── */
.funnel { display: flex; gap: .5rem; flex-wrap: wrap; }
.funnel-item { flex: 1; min-width: 90px; background: var(--clr-surface-2); border: 1px solid var(--clr-border); border-radius: var(--radius); padding: .65rem; text-align: center; }
.funnel-count { font-size: 1.4rem; font-weight: 700; color: var(--clr-primary); }
.funnel-label { font-size: .72rem; color: var(--clr-muted); margin-top: .2rem; }

/* ── Filter bar ────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: .65rem; flex-wrap: wrap; margin-bottom: 1.1rem; align-items: center; }
.filter-bar input[type="search"] { max-width: 260px; }
.filter-bar select { max-width: 170px; }

/* ── Inbox search bar ──────────────────────────────────────────────── */
.inbox-search { position: relative; margin-bottom: .5rem; }
.inbox-search input { padding-left: 2rem; font-size: .83rem; }
.inbox-search-icon { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: var(--clr-muted); font-size: .83rem; pointer-events: none; }

/* ── Inbox filter tabs ─────────────────────────────────────────────── */
.inbox-tabs { display: flex; border-bottom: 1px solid var(--clr-border); background: var(--clr-surface); }
.inbox-tab { flex: 1; padding: .55rem .5rem; text-align: center; font-size: .78rem; font-weight: 600; color: var(--clr-muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; text-decoration: none; transition: all .15s; }
.inbox-tab:hover { color: var(--clr-text); }
.inbox-tab.active { color: var(--clr-primary); border-bottom-color: var(--clr-primary); }

/* ── Settings tabs ─────────────────────────────────────────────────── */
.settings-nav { display: flex; gap: .4rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--clr-border); padding-bottom: .4rem; }
.settings-nav a { padding: .35rem .85rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; color: var(--clr-muted); text-decoration: none; transition: all .15s; }
.settings-nav a:hover { background: var(--clr-bg); color: var(--clr-text); }
.settings-nav a.active { background: var(--clr-primary-light); color: var(--clr-primary-hover); }

/* ── Login ─────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--clr-bg); }
.login-card { width: 100%; max-width: 380px; background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo span { font-size: 1.2rem; font-weight: 800; color: var(--clr-primary); }

/* ── Booking (public klantpagina) ──────────────────────────────────── */
.booking-wrap { min-height: 100vh; background: var(--clr-bg); display: flex; flex-direction: column; }
.booking-header { background: var(--clr-surface); border-bottom: 1px solid var(--clr-border); padding: 1rem 1.5rem; display: flex; align-items: center; gap: .75rem; }
.booking-brand { font-weight: 700; font-size: 1rem; color: var(--clr-primary); }
.booking-container { max-width: 680px; margin: 2rem auto; padding: 0 1rem; width: 100%; }
.booking-card { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.booking-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: 1.25rem 0; }
.booking-slot {
  border: 2px solid var(--clr-border);
  border-radius: var(--radius);
  padding: .85rem;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  background: var(--clr-surface);
}
.booking-slot:hover { border-color: var(--clr-primary); background: var(--clr-primary-light); }
.booking-slot.selected { border-color: var(--clr-primary); background: var(--clr-primary-light); }
.booking-slot-date { font-weight: 600; font-size: .9rem; }
.booking-slot-day { font-size: .78rem; color: var(--clr-muted); margin-top: .1rem; }
.booking-cta {
  display: block; width: 100%;
  background: var(--clr-primary); color: #fff;
  text-align: center; font-size: 1rem; font-weight: 600;
  padding: .9rem 1.5rem;
  border-radius: var(--radius);
  border: none; cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.booking-cta:hover { background: var(--clr-primary-hover); color: #fff; }
.booking-cta:disabled { opacity: .5; cursor: not-allowed; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: .25rem; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--clr-muted); }
.text-sm { font-size: .83rem; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.copy-btn { cursor: pointer; font-size: .73rem; padding: .18rem .5rem; }
a { color: var(--clr-primary); }
a:hover { color: var(--clr-primary-hover); }
hr.divider { border: none; border-top: 1px solid var(--clr-border); margin: 1.1rem 0; }

/* ── HTMX loading ──────────────────────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }
[x-cloak] { display: none !important; }

/* ── Page variants ─────────────────────────────────────────────────── */
.page-full { max-width: none; padding: 0; }

/* ── Mobile bottom navigation ──────────────────────────────────────── */
.mobile-bottom-nav { display: none; }

.mbn-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; flex: 1; padding: .4rem .25rem .5rem;
  color: var(--clr-muted); text-decoration: none;
  font-size: .65rem; font-weight: 600; letter-spacing: .02em;
  background: none; border: none; cursor: pointer;
  transition: color .15s;
}
.mbn-tab:hover { color: var(--clr-primary); }
.mbn-tab.mbn-active { color: var(--clr-primary); }
.mbn-tab svg { flex-shrink: 0; }

.mbn-more-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 300;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.mbn-more-panel {
  background: var(--clr-surface); border-radius: 16px 16px 0 0;
  padding: .75rem 1.25rem calc(env(safe-area-inset-bottom) + 1rem);
  box-shadow: 0 -4px 24px rgba(0,0,0,.15);
}
.mbn-more-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem .25rem; font-size: .95rem; font-weight: 500;
  color: var(--clr-text); text-decoration: none;
  border-bottom: 1px solid var(--clr-border);
}
.mbn-more-item:last-of-type { border-bottom: none; }
.mbn-more-item:hover { color: var(--clr-primary); }

/* ── Calendar ──────────────────────────────────────────────────────── */
.cal-appt-block {
  position: absolute; border-radius: 4px; padding: 3px 6px;
  overflow: hidden; box-sizing: border-box; cursor: pointer;
}

/* ── Orders list (unified, responsive) ─────────────────────────────── */
.orders-date-section { margin-bottom: 1rem; }
.orders-date-label {
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--clr-muted);
  padding: .4rem 0 .3rem;
}
.order-row {
  display: flex; align-items: center;
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg); padding: .85rem 1rem;
  margin-bottom: .4rem; text-decoration: none; color: var(--clr-text);
  transition: box-shadow .12s, border-color .12s;
}
.order-row:hover { border-color: var(--clr-primary); box-shadow: var(--shadow); }
.order-row-left { flex: 1; min-width: 0; }
.order-row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .2rem; }
.order-num { font-weight: 700; font-size: 1rem; }
.order-amount { font-weight: 700; font-size: .95rem; }
.order-row-mid { font-size: .83rem; color: var(--clr-muted); margin-bottom: .4rem; }
.order-time { margin-left: .4rem; }
.order-row-bot { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.order-row-arrow { font-size: 1.2rem; color: var(--clr-muted); margin-left: .75rem; flex-shrink: 0; }

/* Extra kolommen zichtbaar op desktop */
.order-address-col { display: none; }
.order-date-col    { display: none; }

@media (min-width: 769px) {
  .order-address-col { display: inline; margin-left: .6rem; color: var(--clr-muted); font-size: .8rem; }
  .order-date-col    { display: inline-flex; margin-left: auto; font-size: .78rem; color: var(--clr-muted); padding-right: .25rem; }
  .order-time        { display: none; }
}

/* ── Order detail two-column grid ── */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}
@media (max-width: 768px) {
  .order-detail-grid { grid-template-columns: 1fr; }
}

/* ── Workflow stappen slider (mobiel) ── */
.workflow-steps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 768px) {
  .workflow-steps-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: .75rem;
    padding-bottom: .5rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    scrollbar-width: none;
  }
  .workflow-steps-grid::-webkit-scrollbar { display: none; }
  .workflow-steps-grid > * {
    scroll-snap-align: start;
    min-width: 78vw;
    flex-shrink: 0;
  }
}

/* ── Zoekbalk lijst ── */
.list-search {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.list-search input[type="search"] {
  flex: 1;
  min-width: 180px;
  max-width: 340px;
  font-size: .88rem;
  padding: .4rem .75rem;
}
.list-search-empty {
  padding: 2rem;
  text-align: center;
  color: var(--clr-muted);
  font-size: .9rem;
}

/* ── Mobile day view ── */
.mobile-day-view { display: none; }

@media (max-width: 768px) {
  .mobile-day-view { display: block; }
  /* Hide the week cal grid on mobile */
  .cal-week-grid { display: none; }
}

/* ── Gebruikers grid responsive ── */
@media (max-width: 768px) {
  .gebruikers-grid { grid-template-columns: 1fr !important; }
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 56px; }
  .sidebar-nav-link span { display: none; }
  .sidebar-section-label { display: none; }
  .sidebar-brand span { display: none; }
  .sidebar-brand { justify-content: center; padding: 1rem .5rem; }
  .sidebar-nav-link { justify-content: center; padding: .6rem; }
  .sidebar-profile-btn { justify-content: center; }
  .sidebar-profile-info { display: none; }
  .sidebar-profile-btn svg { display: none; }
  .sidebar-profile-menu { left: 0; right: -80px; }
  .sidebar-search { display: none; }
}
@media (max-width: 768px) {
  /* Hide sidebar completely — bottom nav takes over */
  .sidebar { display: none; }
  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--clr-surface);
    border-top: 1px solid var(--clr-border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .main-content { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .main-content:has(.inbox) { height: calc(100vh - 56px - env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .inbox { flex-direction: column; }
  .inbox-sidebar { width: 100%; max-height: 40vh; }
}
