/**
 * Shared visual system for CS Enterprises service app.
 * Pages still use Tailwind utilities; this file unifies spacing, tables, cards, and chrome.
 */

:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e8edf2;
    --canvas: #f3f5f8;
    --card: #ffffff;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #ecfdf8;
    --sidebar: #0b1f24;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.18);
}

[x-cloak] { display: none !important; }

html, body {
    font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.app-sidebar {
    background: linear-gradient(180deg, #0d2429 0%, #0a1a1e 100%);
    color: #e2e8f0;
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
}
.app-sidebar .brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: -0.03em;
}
.nav-section {
    padding: 1.1rem 0.85rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.7);
}
.nav-link {
    display: flex;
    align-items: center;
    border-radius: 0.65rem;
    padding: 0.5rem 0.75rem;
    color: #cbd5e1;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.nav-link-active {
    background: rgba(20, 184, 166, 0.16);
    color: #99f6e4;
    box-shadow: inset 3px 0 0 #14b8a6;
}

/* Top bar */
.app-topbar {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.app-search {
    width: 100%;
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 999px;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.app-search:focus {
    background: #fff;
    border-color: #99f6e4;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* Page title */
.app-title {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ink);
}
.app-sub {
    margin-top: 0.2rem;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Buttons */
.btn-primary,
button[type="submit"].inline-flex,
a.inline-flex.items-center.rounded-lg.bg-teal-700 {
    border-radius: 0.7rem !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25);
    transition: transform 0.1s ease, background 0.15s ease;
}
.btn-primary:hover,
a.inline-flex.items-center.rounded-lg.bg-teal-700:hover {
    transform: translateY(-1px);
}

/* Forms */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="search"]),
select,
textarea {
    border-color: #d7dee6 !important;
    border-radius: 0.7rem !important;
    background: #fff;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):focus,
select:focus,
textarea:focus {
    border-color: #14b8a6 !important;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15) !important;
    outline: none;
}

/* Cards & panels used across pages */
main .rounded-xl.bg-white,
main .rounded-xl.border.bg-white,
main .rounded-2xl.bg-white,
main .overflow-x-auto.rounded-xl {
    box-shadow: var(--shadow);
    border-color: var(--line) !important;
    border-radius: var(--radius) !important;
}

/* Tables */
main table.min-w-full {
    border-collapse: separate;
    border-spacing: 0;
}
main thead th {
    font-size: 0.68rem !important;
    font-weight: 650 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b !important;
    background: #f8fafc !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    border-bottom: 1px solid var(--line);
}
main tbody td {
    padding-top: 0.8rem !important;
    padding-bottom: 0.8rem !important;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
main tbody tr:last-child td {
    border-bottom: 0;
}
main tbody tr:hover td {
    background: #f8fafc;
}

/* Badges a bit tighter */
main .inline-flex.items-center.rounded-full {
    letter-spacing: 0.01em;
    font-weight: 600;
}

/* Flash */
.flash-ok, .flash-err {
    border-radius: 0.85rem;
    padding: 0.8rem 1rem;
    font-size: 0.875rem;
}
.flash-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Technician bottom nav + back / home */
.tech-tabbar {
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -18px rgba(15,23,42,0.35);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.tech-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border-radius: 0.7rem;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}
.tech-home-bar {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0.7rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f766e;
    box-shadow: var(--shadow);
}
input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

@media (max-width: 640px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea {
        font-size: 16px !important; /* stop iOS zoom on focus */
        min-height: 2.75rem;
    }
}

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(20,184,166,0.18), transparent 50%),
        radial-gradient(900px 400px at 110% 10%, rgba(15,23,42,0.08), transparent 45%),
        var(--canvas);
}

@media print {
    .no-print { display: none !important; }
    .print-area { box-shadow: none !important; }
}
