/* CPC X DAIKIN Dashboard — Apple-inspired light theme */
:root {
    --bg:        #f5f5f7;  /* Apple light gray page */
    --surface:   #ffffff;  /* card white */
    --surface-2: #f5f5f7;  /* inset / input gray */
    --ink:       #1d1d1f;  /* near-black primary text */
    --ink-2:     #515154;  /* secondary gray text */
    --ink-3:     #6e6e73;  /* tertiary gray text (AA-legible on light bg) */
    --line:      #e3e3e6;  /* hairline border */
    --accent:    #0071e3;  /* Apple blue */
    --accent-2:  #0a84ff;
    --green:     #1d8a4e;
    --amber:     #b35309;
    --red:       #d12f2f;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    color: var(--ink);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: -0.01em;
    margin: 0;
    padding: 0;
}

/* Login */
.login-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 24px 60px -20px rgba(0, 0, 0, 0.18);
}

/* Cards */
.dashboard-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 28px -18px rgba(0, 0, 0, 0.22);
    transition: box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 22px 50px -24px rgba(0, 0, 0, 0.30);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.5s ease-out forwards; }

.logo-container img, .logo-container svg { max-height: 48px; object-fit: contain; }

/* KPI cards */
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px -22px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 18px 40px -24px rgba(0, 0, 0, 0.30);
}
.kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    font-weight: 600;
}
.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 0.2rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.kpi-sub {
    font-size: 0.72rem;
    color: var(--ink-3);
    margin-top: 0.2rem;
}

/* Progress bars */
.progress-track {
    width: 100%;
    height: 8px;
    background: #e8e8ed;
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #0071e3, #34aaff);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.complete { background: linear-gradient(90deg, #1d8a4e, #34c759); }
.progress-fill.behind   { background: linear-gradient(90deg, #c2410c, #ff9f0a); }

/* Order rows */
.order-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.9rem 1.1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.order-row:hover {
    border-color: #d2d2d7;
    box-shadow: 0 10px 26px -18px rgba(0, 0, 0, 0.30);
    transform: translateY(-1px);
}

/* Stage pills */
.stage-pill {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    padding: 0.14rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.stage-queued    { background: #ececef; color: #6e6e73; }
.stage-cutting   { background: #e3f2fd; color: #0a6cc4; }
.stage-welding   { background: #fff2dd; color: #b35309; }
.stage-assembly  { background: #f3e8ff; color: #8a3ffc; }
.stage-finishing { background: #fde7f3; color: #c41d7f; }
.stage-qc        { background: #e0f7fa; color: #007a8a; }
.stage-shipped   { background: #e3f7eb; color: #1d8a4e; }

/* Urgency badges */
.badge-high   { background-color: #ffe5e5; color: #c11717; }
.badge-medium { background-color: #fff2dd; color: #b35309; }
.badge-low    { background-color: #e3f2fd; color: #0a6cc4; }

/* Inputs */
.field {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.field::placeholder { color: var(--ink-3); }
.field:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

/* Primary button (pill) */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-radius: 980px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.1s ease;
}
.btn-primary:hover  { background: #0077ed; }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Secondary / ghost button (pill) */
.btn-ghost {
    background: #ffffff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 980px;
    font-weight: 500;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-ghost:hover { background: #f5f5f7; border-color: #d2d2d7; }

/* Custom scrollbars (light) */
.scroll-area::-webkit-scrollbar { width: 8px; }
.scroll-area::-webkit-scrollbar-thumb { background: #d2d2d7; border-radius: 999px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }

/* ---- Live indicator ---- */
.live-dot {
    width: 8px; height: 8px; border-radius: 999px; background: #1d8a4e;
    box-shadow: 0 0 0 0 rgba(29, 138, 78, 0.5);
    animation: livePulse 2s infinite;
}
@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(29, 138, 78, 0.45); }
    70%  { box-shadow: 0 0 0 7px rgba(29, 138, 78, 0); }
    100% { box-shadow: 0 0 0 0 rgba(29, 138, 78, 0); }
}

/* ---- Admin panel ---- */
.admin-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px -22px rgba(0, 0, 0, 0.22);
}
.admin-input {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}
.admin-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    transition: box-shadow 0.2s ease;
}
.admin-row:hover { box-shadow: 0 8px 22px -16px rgba(0,0,0,0.3); }
.admin-row.dirty { border-color: #f5b955; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12); }

/* Toast */
#toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1d1d1f; color: #fff; padding: 0.7rem 1.2rem; border-radius: 999px;
    font-size: 0.85rem; font-weight: 500; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease; z-index: 100;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: #c11717; }
