/* =========================================================
   TechniCare — main stylesheet
   Clean, white + per-admin primary color.
   ========================================================= */

* { box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.10);

    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --border-strong: #d1d5db;

    --text: #0f172a;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;

    --success: #16a34a;
    --warning: #d97706;
    --danger:  #dc2626;
    --info:    #2563eb;

    --radius: 10px;
    --radius-sm: 8px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow:    0 2px 6px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .04);
    --shadow-md: 0 6px 14px rgba(15, 23, 42, .08), 0 16px 40px rgba(15, 23, 42, .06);

    --t: 160ms ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #111827;
    --surface-2: #1f2937;
    --border: #374151;
    --border-strong: #4b5563;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --text-soft: #6b7280;
    --shadow: 0 2px 6px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

html, body { margin: 0; padding: 0; }
body {
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* -------- app shell -------- */
.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; max-height: 100vh;
    overflow: hidden;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 8px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.brand-mark {
    width: 38px; height: 38px;
    background: var(--primary);
    color: white;
    border-radius: 9px;
    display: grid; place-items: center;
    font-weight: 700; font-size: 18px;
    box-shadow: 0 4px 10px var(--primary-soft);
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--text-muted); font-size: 12px; }

.sidebar-nav {
    display: flex; flex-direction: column; gap: 2px;
    flex: 1; min-height: 0;
    overflow-y: auto;
    margin-right: -6px; padding-right: 6px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    color: var(--text-muted);
    border-radius: 8px;
    font-weight: 500;
    transition: var(--t);
}
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}
.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}
.nav-logout { color: var(--text-muted); margin-top: auto; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); }

/* -------- main / topbar -------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }

.sub-pay {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), #0f172a);
    color: #fff !important; text-decoration: none; font-weight: 600; font-size: 13px;
    box-shadow: 0 8px 18px rgba(0,0,0,.12);
    transition: transform .15s ease, box-shadow .15s ease;
}
.sub-pay:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 12px 22px rgba(0,0,0,.18); }
.sub-pay svg { stroke: #fff; }
.sub-pay-warn {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px;
    border-radius: 100px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.user-chip .avatar {
    width: 30px; height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700;
}
.user-name { font-weight: 600; line-height: 1.1; }
.user-email { font-size: 11px; color: var(--text-muted); }

.content { padding: 24px; max-width: 1280px; width: 100%; }

.footbar {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex; justify-content: space-between;
    color: var(--text-muted); font-size: 12px;
}

/* -------- cards / grids -------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.card-head h3 { margin: 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.gap-lg { gap: 18px; margin-top: 18px; }

@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .app { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.stat-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-foot  { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* -------- tables -------- */
.table-clean {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table-clean th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 11px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.table-clean td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table-clean tr:last-child td { border-bottom: 0; }
.table-clean tr:hover td { background: var(--surface-2); }

.row-title { font-weight: 600; }
.row-sub   { color: var(--text-muted); font-size: 12px; }

.actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.inline  { display: inline; }

/* -------- pills / badges -------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 100px;
    font-size: 11.5px; font-weight: 600;
}
.badge-ok    { background: #dcfce7; color: #166534; }
.badge-warn  { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }

.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.pill-active   { background: #dcfce7; color: #166534; }
.pill-disabled { background: #fee2e2; color: #991b1b; }
.pill-pending  { background: #fef3c7; color: #92400e; }

.color-swatch {
    width: 16px; height: 16px;
    display: inline-block;
    border-radius: 4px;
    border: 1px solid var(--border-strong);
    vertical-align: middle;
}
.color-swatch.lg { width: 28px; height: 28px; border-radius: 6px; }

/* -------- buttons -------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: var(--t);
    text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-warn   { background: #fff7ed; color: #92400e; border-color: #fed7aa; }
.btn-ok     { background: #ecfdf5; color: #166534; border-color: #bbf7d0; }
.btn-danger { background: #fff1f2; color: #b91c1c; border-color: #fecaca; }
.btn-link   { background: transparent; border-color: transparent; color: var(--primary); }
.btn-link:hover { background: var(--primary-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* -------- forms -------- */
.lbl {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
}
input[type=text],
input[type=email],
input[type=password],
input[type=tel],
input[type=number],
input[type=date],
input[type=time],
select.select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font: inherit;
    background: var(--surface);
    color: var(--text);
    transition: var(--t);
}
input:focus, textarea:focus, select.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row { display: block; }
.form-row-full { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; border-top: 1px dashed var(--border); }

.chk { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.chk input { width: auto; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }
.input-search { flex: 1; }

/* color picker row */
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 50px; height: 38px; padding: 0; border-radius: 6px; cursor: pointer; }
.color-hex { width: 130px; font-family: ui-monospace, monospace; }

/* -------- plan picker -------- */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.plan-card {
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    background: var(--surface);
    transition: var(--t);
}
.plan-card input { display: none; }
.plan-card:hover { border-color: var(--primary); }
.plan-card.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.plan-title { font-weight: 600; }
.plan-price { font-size: 22px; font-weight: 700; margin: 4px 0; }
.plan-days  { color: var(--text-muted); font-size: 12px; }

/* -------- flash -------- */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13.5px;
    border: 1px solid;
}
.flash-ok     { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.flash-warn   { background: #fff7ed; border-color: #fed7aa; color: #92400e; }
.flash-error  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info   { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* -------- tooltip (?) -------- */
.tooltip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    position: relative;
    margin-left: 4px;
    transition: var(--t);
}
.tooltip:hover { background: var(--primary); color: white; border-color: var(--primary); }
.tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%);
    background: #0f172a; color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px; font-weight: 400;
    white-space: normal;
    min-width: 220px;
    max-width: 320px;
    line-height: 1.4;
    opacity: 0; visibility: hidden;
    transition: var(--t);
    box-shadow: var(--shadow-md);
    z-index: 100;
    pointer-events: none;
    text-align: left;
}
.tooltip:hover::after { opacity: 1; visibility: visible; }

/* -------- profile head -------- */
.profile-head {
    display: flex; align-items: center; gap: 18px;
}
.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    color: white;
    font-size: 32px;
    font-weight: 700;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.profile-meta { flex: 1; }
.profile-actions { display: flex; gap: 8px; }

/* -------- empty state -------- */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.bullet-list { padding-left: 22px; line-height: 1.8; }
.hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
