:root {
    --sidebar-w: 250px;
    --brand: #0b6e8f;
    --brand-dark: #08485e;
    --bg: #f3f6f9;
    --card-border: #e5eaf0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: #1f2d3d;
    font-size: .925rem;
}

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand-dark) 0%, #0a3d4f 100%);
    color: #cfe3ea;
    position: fixed; top: 0; bottom: 0; left: 0;
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .25s;
}
.sidebar .brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.15rem 1.1rem; color: #fff; text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: rgba(255,255,255,.14);
    display: grid; place-items: center; font-size: 1.35rem;
}
.brand-text { font-weight: 700; line-height: 1.15; font-size: .98rem; }
.brand-text small { display: block; font-weight: 400; font-size: .72rem; opacity: .7; }
.sidebar .nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.sidebar .nav-link {
    color: #cfe3ea; border-radius: 10px; padding: .6rem .8rem;
    display: flex; align-items: center; gap: .7rem; margin-bottom: 2px; font-weight: 500;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--brand-dark); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 1rem .8rem .35rem; }
.sidebar-footer { padding: .75rem 1.1rem; font-size: .72rem; opacity: .5; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--card-border);
    display: flex; align-items: center; gap: 1rem;
    padding: .65rem 1.5rem;
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; white-space: nowrap; }
.topbar-search { position: relative; flex: 0 1 420px; margin-left: 1rem; }
.topbar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8a99a8; }
.topbar-search input { padding-left: 34px; border-radius: 20px; background: #f1f4f7; border-color: transparent; }
.user-btn { display: flex; align-items: center; gap: .5rem; border-radius: 20px; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
    display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}
.content { padding: 1.5rem; flex: 1; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
    .content { padding: 1rem; }
}

/* ---------- Cards ---------- */
.card { border: 1px solid var(--card-border); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--card-border); font-weight: 600; padding: .85rem 1.1rem; border-radius: 14px 14px 0 0 !important; }
.card-header .bi { color: var(--brand); }
.stat-card { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; gap: 1rem; align-items: center; }
.min-w-0 { min-width: 0; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: #6b7a89; }
.bg-soft-primary { background: #e3f1f7; color: var(--brand); }
.bg-soft-success { background: #e2f6ea; color: #198754; }
.bg-soft-danger { background: #fde8ea; color: #dc3545; }
.bg-soft-warning { background: #fff4d9; color: #b7791f; }
.bg-soft-info { background: #e5f0ff; color: #3b6fd4; }
.bg-soft-purple { background: #efe8fb; color: #6f42c1; }

.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.text-brand { color: var(--brand) !important; }
a { color: var(--brand); }

.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7a89; font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table-hover tbody tr { cursor: default; }
.table td { vertical-align: middle; }

.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; color: #3c4b5a; }
.form-control, .form-select { border-color: #d5dde5; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(11,110,143,.15); }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); font-weight: 700; margin: 1.25rem 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }

.doctor-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: #8a99a8; }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }

.license-card { border: 1px solid #f3d27a; background: linear-gradient(90deg, #fffaf0 0%, #fff 60%); }
.license-icon { background: #fff1c9; color: #b7791f; }
.license-price { font-size: 1.9rem; font-weight: 800; color: #0b6e8f; line-height: 1; }

/* ---------- Eye exam table ---------- */
.eye-table th { width: 22%; background: #f8fafc; font-weight: 600; font-size: .82rem; }
.eye-table td input { min-width: 70px; }
.eye-head { text-align: center; font-weight: 700; color: var(--brand); }
.rx-table input { text-align: center; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: #dbe4ec; }
.timeline-item { position: relative; margin-bottom: 1.1rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.5rem; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); }

/* ---------- Day board ---------- */
.day-board { display: grid; grid-template-columns: 70px repeat(var(--cols, 2), 1fr); border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; background: #fff; }
.day-board .db-head { background: #f8fafc; font-weight: 600; padding: .6rem; border-bottom: 1px solid var(--card-border); text-align: center; position: sticky; top: 0; }
.day-board .db-time { font-size: .78rem; color: #6b7a89; padding: .35rem .5rem; border-bottom: 1px solid #f0f3f6; text-align: right; }
.day-board .db-slot { border-left: 1px solid var(--card-border); border-bottom: 1px solid #f0f3f6; padding: 3px 4px; min-height: 36px; cursor: pointer; }
.day-board .db-slot.free:hover { background: #eef7fa; }
.day-board .db-slot.free:hover::after { content: '+ Randevu ver'; font-size: .75rem; color: var(--brand); }
.day-board .db-appt { border-radius: 6px; padding: 3px 7px; font-size: .8rem; color: #fff; margin-bottom: 2px; line-height: 1.25; }
.day-board .db-appt small { opacity: .85; }
.day-board .db-appt.cancel { opacity: .45; text-decoration: line-through; }
.occupancy-bar { height: 8px; border-radius: 4px; background: #e9eef3; overflow: hidden; }
.occupancy-bar > div { height: 100%; }

/* ---------- FullCalendar ---------- */
.fc { --fc-border-color: #e5eaf0; --fc-today-bg-color: #f0f8fb; font-size: .85rem; }
.fc .fc-button-primary { background: #fff; color: #33475b; border-color: #d5dde5; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--brand); border-color: var(--brand); color: #fff; }
.fc .fc-button-primary:hover { background: #eef3f7; color: #33475b; }
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 700; }
.fc-event { cursor: pointer; border-radius: 5px; }
.fc-event.st-iptal { opacity: .45; text-decoration: line-through; }
.fc-event.st-gelmedi { opacity: .6; }
.fc-event.st-tamamlandi .fc-event-title::before { content: '✓ '; }

/* ---------- Scan review ---------- */
.scan-viewer { position: sticky; top: 80px; }
.scan-img-wrap { background: #1f2a33; border-radius: 12px; overflow: auto; max-height: calc(100vh - 220px); text-align: center; }
.scan-img-wrap img { max-width: 100%; transition: transform .2s; transform-origin: center center; }
.scan-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.scan-thumbs img.active { border-color: var(--brand); }
.ai-field-changed { background: #fff9e6 !important; }
.visit-card.excluded { opacity: .5; }
.visit-card .card-header { display: flex; align-items: center; gap: .75rem; }
.confidence { font-size: .75rem; }

.ts-wrapper.form-control, .ts-wrapper.form-select { padding: 0; }
.ts-control { border-color: #d5dde5; min-height: 38px; }
.ts-dropdown .option small { color: #6b7a89; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #08485e, #0b6e8f 55%, #2aa3b8); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; border-radius: 18px; border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { width: 64px; height: 64px; border-radius: 18px; background: #e3f1f7; color: var(--brand); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 1rem; }

/* ---------- Print ---------- */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}
