* { box-sizing: border-box; }

:root {
    --bg:          #f1f5f9;
    --surface:     #ffffff;
    --surface-2:   #f8fafc;
    --border:      #e2e8f0;
    --text:        #0f172a;
    --text-dim:    #64748b;

    --accent:      #0d9488;
    --accent-2:    #0284c7;
    --accent-dim:  #ccfbf1;

    --blue:        #0284c7;
    --blue-dim:    #e0f2fe;
    --ok:          #16a34a;
    --ok-dim:      #dcfce7;
    --warn:        #d97706;
    --warn-dim:    #fef3c7;
    --danger:      #dc2626;
    --danger-dim:  #fee2e2;
    --slate-dim:   #f1f5f9;

    --radius:      12px;
    --shadow:      0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
    --shadow-lift: 0 10px 40px rgba(15,23,42,0.10);

    --sidebar-w:      236px;
    --sidebar-w-collapsed: 76px;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Shell / Sidebar ---------- */

.mc-shell {
    display: flex;
    min-height: 100vh;
}

.mc-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width 0.22s ease;
    z-index: 40;
}
.mc-sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.mc-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.mc-brand { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.brand-mark {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.brand-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
}
.mc-sidebar.collapsed .brand-text { display: none; }

.mc-collapse-btn {
    width: 28px; height: 28px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 7px;
    color: var(--text-dim);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}
.mc-collapse-btn:hover { color: var(--text); }
.mc-sidebar.collapsed .mc-collapse-btn i { transform: rotate(180deg); }

.mc-nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.mc-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: background 0.15s, color 0.15s;
}
.mc-nav-link i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.mc-nav-link:hover { background: var(--surface-2); color: var(--text); }
.mc-nav-link.active { background: var(--accent-dim); color: var(--accent); }
.mc-sidebar.collapsed .mc-nav-link span { display: none; }
.mc-sidebar.collapsed .mc-nav-link { justify-content: center; }

.mc-sidebar.collapsed .mc-nav-link::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 60;
}
.mc-sidebar.collapsed .mc-nav-link:hover::after { opacity: 1; }

.mc-sidebar-bottom {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.mc-user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; overflow: hidden; }
.mc-user-chip .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.mc-user-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.mc-user-info .name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-user-info .role { font-size: 11px; color: var(--text-dim); }
.mc-sidebar.collapsed .mc-user-info { display: none; }

.mc-logout {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim);
    border: 1px solid var(--border);
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.mc-logout:hover { color: var(--danger); border-color: var(--danger); }

.mc-main { flex: 1; min-width: 0; }
.mc-content { max-width: 1320px; margin: 0 auto; padding: 26px 28px 60px; }

.mc-page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.mc-page-head h2 { font-size: 21px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.mc-page-head p { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; }

/* ---------- Stat cards ---------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 12px; color: var(--text-dim); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.stat-card .stat-label i { color: var(--accent); font-size: 13px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -0.02em; }
.stat-card .stat-value.c-accent { color: var(--accent); }
.stat-card .stat-value.c-ok { color: var(--ok); }
.stat-card .stat-value.c-warn { color: var(--warn); }
.stat-card .stat-value.c-danger { color: var(--danger); }

/* ---------- Panels ---------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.panel-head h3 { font-size: 15px; margin: 0; font-weight: 700; }
.panel-body { padding: 20px; }
.panel-body.p-0 { padding: 0; }

/* ---------- Table ---------- */

.mc-table { width: 100%; border-collapse: collapse; }
.mc-table thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); font-weight: 700; padding: 11px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mc-table tbody td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.mc-table tbody tr:last-child td { border-bottom: none; }
.mc-table tbody tr:hover { background: var(--surface-2); }

/* ---------- Pills ---------- */

.pill { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 100px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill-slate  { background: var(--slate-dim); color: #475569; }
.pill-blue   { background: var(--blue-dim);  color: var(--blue); }
.pill-teal   { background: var(--accent-dim);color: var(--accent); }
.pill-amber  { background: var(--warn-dim);  color: #b45309; }
.pill-green  { background: var(--ok-dim);    color: #15803d; }
.pill-red    { background: var(--danger-dim);color: var(--danger); }

/* ---------- Buttons ---------- */

.btn-mc { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: #fff; border: none; padding: 10px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-mc:hover { background: #0f766e; color: #fff; }
.btn-mc-outline { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 10px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-mc-outline:hover { background: var(--surface-2); }
.btn-mc-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-mc-danger { background: var(--danger); }
.btn-mc-danger:hover { background: #b91c1c; }

.btn-icon-mc { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.btn-icon-mc:hover { color: var(--accent); border-color: var(--accent); }
.btn-icon-mc.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- Auth pages ---------- */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top, #ecfeff 0%, #f1f5f9 55%); padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lift); overflow: hidden; }
.auth-card-top { text-align: center; padding: 36px 30px 22px; }
.auth-logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; margin: 0 auto 14px; }
.auth-card-top h1 { font-size: 22px; margin: 0; font-weight: 700; }
.auth-card-top p { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; font-weight: 500; }
.auth-card-body { padding: 10px 30px 32px; }
.auth-demo-row { display: flex; gap: 8px; margin-top: 16px; }
.auth-demo-row .btn-mc-outline { flex: 1; }

/* ---------- Forms ---------- */

.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
.form-control, .form-select { border: 1px solid var(--border); border-radius: 9px; font-size: 13.5px; padding: 9px 12px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ---------- Modal ---------- */

.modal-content { border: none; border-radius: var(--radius); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 14px 20px; }

/* ---------- Appointment calendar grid ---------- */

.mc-cal-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.mc-cal-datepicker { display: flex; align-items: center; gap: 8px; }
.mc-cal-datepicker input { border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; font-size: 13.5px; }

.mc-cal-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.mc-cal-grid { display: grid; min-width: 720px; }

.mc-cal-head-row { display: contents; }
.mc-cal-corner, .mc-cal-doc-head {
    position: sticky; top: 0; background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: 12px 10px;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
}
.mc-cal-corner { z-index: 3; left: 0; }
.mc-cal-doc-head { text-align: center; border-left: 1px solid var(--border); }
.mc-cal-doc-head .doc-name { display: block; color: var(--text); }
.mc-cal-doc-head .doc-spec { display: block; color: var(--text-dim); font-weight: 500; font-size: 10.5px; margin-top: 2px; }

.mc-cal-time {
    position: sticky; left: 0; background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    font-size: 11.5px;
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
    z-index: 1;
}
.mc-cal-cell {
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    min-height: 46px;
    padding: 3px;
    cursor: pointer;
    transition: background 0.12s;
}
.mc-cal-cell:hover { background: var(--accent-dim); }
.mc-cal-cell.past { cursor: not-allowed; background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #f1f5f9 6px, #f1f5f9 12px); }
.mc-cal-cell.past:hover { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #f1f5f9 6px, #f1f5f9 12px); }

.mc-cal-appt {
    border-radius: 6px;
    padding: 5px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    height: 100%;
    cursor: pointer;
}
.mc-cal-appt.status-scheduled { background: var(--blue-dim); color: #0369a1; border-left: 3px solid var(--blue); }
.mc-cal-appt.status-completed { background: var(--ok-dim); color: #15803d; border-left: 3px solid var(--ok); }
.mc-cal-appt.status-cancelled { background: var(--danger-dim); color: var(--danger); border-left: 3px solid var(--danger); text-decoration: line-through; opacity: 0.75; }
.mc-cal-appt.status-no_show { background: var(--warn-dim); color: #b45309; border-left: 3px solid var(--warn); }

.mc-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.mc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mc-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Misc ---------- */

.fs-13 { font-size: 13px; }
.text-dim { color: var(--text-dim); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-state i { font-size: 30px; color: var(--border); margin-bottom: 12px; }

/* ---------- Mobile ---------- */

.mc-mobile-toggle { display: none; }

@media (max-width: 880px) {
    .mc-shell { position: relative; }
    .mc-sidebar { position: fixed; left: -260px; top: 0; height: 100vh; box-shadow: var(--shadow-lift); }
    .mc-sidebar.mobile-open { left: 0; }
    .mc-collapse-btn { display: none; }
    .mc-mobile-toggle {
        display: flex; align-items: center; justify-content: center;
        width: 36px; height: 36px; border-radius: 9px;
        border: 1px solid var(--border); background: var(--surface); color: var(--text);
        position: sticky; top: 14px; left: 14px; margin: 14px 0 0 14px; z-index: 30;
    }
    .mc-content { padding: 10px 16px 40px; }
}
@media (min-width: 881px) { .mc-mobile-toggle { display: none; } }
