@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --orange: #f97316;
    --purple: #9333ea;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --teal: #0f9d58;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #f59e0b;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --radius: 14px;
    --radius-sm: 8px;
    --font: 'Plus Jakarta Sans', sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ─── Layout ─────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 800;
    color: var(--primary);
    margin-right: 16px;
}

.navbar-brand .brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: grid; place-items: center;
    color: white; font-size: 18px;
}

.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }

.nav-link {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500;
    color: var(--text-muted);
    transition: all .2s;
    white-space: nowrap;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: #ede9fe; color: var(--primary); font-weight: 600; }

.nav-link .nav-icon { font-size: 15px; }

.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.btn-new-order {
    display: flex; align-items: center; gap: 7px;
    background: var(--primary);
    color: white;
    border: none; cursor: pointer;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600;
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(79,70,229,.35);
}
.btn-new-order:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.4); }

.user-menu {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all .2s;
}
.user-menu:hover { border-color: var(--primary-light); color: var(--primary); }

.logout-link {
    color: var(--red); font-size: 13px; font-weight: 500;
    padding: 6px 12px; border-radius: var(--radius-sm);
    transition: all .2s;
}
.logout-link:hover { background: #fee2e2; }

/* ─── Page ─────────────────────────────────────────── */
.page-content {
    margin-top: 60px;
    padding: 28px 32px;
    width: 100%; max-width: 1300px;
    margin-left: auto; margin-right: auto;
}

/* ─── Page Header ─────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header-title h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.page-header-title p { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }

/* ─── Search Bar ──────────────────────────────────── */
.search-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.search-input-wrap {
    display: flex; align-items: center; gap: 10px;
}
.search-input-wrap span { color: var(--text-muted); font-size: 16px; }
.search-input {
    width: 100%; border: none; outline: none;
    font-size: 14px; color: var(--text); background: transparent;
}
.search-input::placeholder { color: var(--text-light); }
.search-tip { color: var(--primary); font-size: 12px; margin-top: 8px; }

/* ─── Stats Grid ──────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    border-radius: var(--radius);
    padding: 20px 22px;
    color: white;
    display: flex; align-items: center; justify-content: space-between;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card::after {
    content: '';
    position: absolute; right: -20px; top: -20px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
}

.stat-card.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-card.purple { background: linear-gradient(135deg, #9333ea, #7c3aed); }
.stat-card.green  { background: linear-gradient(135deg, #22c55e, #16a34a); }

.stat-card-label { font-size: 13px; font-weight: 600; opacity: .85; margin-bottom: 6px; }
.stat-card-value { font-size: 36px; font-weight: 800; line-height: 1; }
.stat-card-sub { font-size: 12px; opacity: .75; margin-top: 5px; }
.stat-card-icon { font-size: 32px; opacity: .85; position: relative; z-index: 1; }

/* ─── Revenue Grid ────────────────────────────────── */
.revenue-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-bottom: 20px;
}

.revenue-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow-sm);
}

.revenue-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 22px;
    flex-shrink: 0;
}
.revenue-icon.green-bg { background: #dcfce7; }
.revenue-icon.purple-bg { background: #ede9fe; }

.revenue-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.revenue-value { font-size: 24px; font-weight: 800; color: var(--text); margin-top: 2px; }

/* ─── Workflow Pipeline ───────────────────────────── */
.pipeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.pipeline-card h2 { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.pipeline-steps {
    display: flex; align-items: center; gap: 0;
}
.pipeline-step {
    flex: 1;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    color: white;
    font-weight: 700;
    font-size: 22px;
    position: relative;
    transition: transform .2s;
    cursor: default;
}
.pipeline-step:hover { transform: scale(1.04); }
.pipeline-step-label { font-size: 12px; font-weight: 500; opacity: .85; margin-top: 4px; }
.pipeline-arrow {
    color: var(--text-light); font-size: 18px;
    flex-shrink: 0; padding: 0 6px;
}

.step-orange { background: linear-gradient(135deg, #f97316, #fb923c); }
.step-purple { background: linear-gradient(135deg, #9333ea, #a855f7); }
.step-blue   { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.step-cyan   { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.step-teal   { background: linear-gradient(135deg, #10b981, #34d399); }
.step-green  { background: linear-gradient(135deg, #22c55e, #4ade80); }

/* ─── Bottom Grid ─────────────────────────────────── */
.bottom-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-view-all { font-size: 13px; font-weight: 600; color: var(--primary); }
.panel-view-all:hover { text-decoration: underline; }

/* ─── Orders List ─────────────────────────────────── */
.order-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.order-row:last-child { border-bottom: none; }
.order-row:hover { background: var(--bg); }

.order-row-left { display: flex; align-items: center; gap: 12px; }
.order-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 15px;
    flex-shrink: 0;
}
.order-icon.completed { background: #dcfce7; }
.order-icon.pending   { background: #fef3c7; }
.order-icon.printing  { background: #dbeafe; }

.order-number { font-size: 14px; font-weight: 700; color: var(--primary); }
.order-customer { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

.status-badge {
    display: inline-flex; align-items: center;
    padding: 4px 11px;
    border-radius: 99px;
    font-size: 12px; font-weight: 600;
}
.badge-completed { background: #dcfce7; color: #15803d; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-plating   { background: #ede9fe; color: #6d28d9; }
.badge-printing  { background: #dbeafe; color: #1d4ed8; }
.badge-finishing { background: #cffafe; color: #0e7490; }
.badge-packing   { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }

.order-date { font-size: 12px; color: var(--text-light); text-align: right; }

/* ─── Activity Feed ───────────────────────────────── */
.activity-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 22px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg); }

.activity-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; flex-shrink: 0;
}

.activity-order { font-size: 13px; font-weight: 600; color: var(--primary); }
.activity-status { font-size: 12.5px; color: var(--text-muted); }
.activity-time { font-size: 11.5px; color: var(--text-light); margin-top: 1px; }

/* ─── Forms & Modals ──────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
    background: var(--surface);
    border-radius: 18px;
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,.2);
    animation: slideUp .25s ease;
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 28px 18px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 800; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px; border: none;
    background: var(--bg); color: var(--text-muted);
    cursor: pointer; font-size: 16px;
    display: grid; place-items: center;
    transition: all .15s;
}
.modal-close:hover { background: var(--border); }

.modal-body { padding: 24px 28px; }
.modal-footer { padding: 0 28px 24px; display: flex; gap: 10px; justify-content: flex-end; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px; color: var(--text);
    background: var(--surface);
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600;
    cursor: pointer; border: none; transition: all .2s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* ─── Table ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; padding: 12px 20px;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}
tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

.action-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 6px;
    font-size: 12.5px; font-weight: 600;
    cursor: pointer; border: none; transition: all .15s;
    background: var(--bg); color: var(--text-muted);
    border: 1px solid var(--border);
}
.action-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.action-btn.danger:hover { background: var(--red); color: white; border-color: var(--red); }

/* ─── Login Page ──────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ede9fe 0%, #dbeafe 50%, #e0f2fe 100%);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border-radius: 22px;
    width: 100%; max-width: 420px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    animation: slideUp .3s ease;
}
.login-logo {
    display: flex; align-items: center; gap: 12px;
    font-size: 22px; font-weight: 800; color: var(--primary);
    margin-bottom: 28px; justify-content: center;
}
.login-logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px; display: grid; place-items: center;
    color: white; font-size: 22px;
}
.login-card h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; text-align: center; }
.login-card p { color: var(--text-muted); text-align: center; font-size: 13.5px; margin-bottom: 28px; }
.login-error { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; margin-bottom: 16px; }

/* ─── Track Order Page ────────────────────────────── */
.track-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-top: 20px;
}
.track-info { padding: 24px 28px; }
.track-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 24px; }
.track-info-item .label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.track-info-item .value { font-size: 15px; font-weight: 700; color: var(--text); }

.timeline { padding: 24px 28px; border-top: 1px solid var(--border); }
.timeline h3 { font-size: 14px; font-weight: 700; margin-bottom: 20px; }
.timeline-list { list-style: none; position: relative; padding-left: 28px; }
.timeline-list::before {
    content: ''; position: absolute; left: 7px; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-item::before {
    content: ''; position: absolute; left: -25px; top: 4px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--border);
}
.timeline-item.done::before { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.timeline-item.active::before { background: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.25); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(79,70,229,.25); } 50% { box-shadow: 0 0 0 6px rgba(79,70,229,.1); } }

.timeline-label { font-size: 14px; font-weight: 600; }
.timeline-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Empty State ─────────────────────────────────── */
.empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ─── Alert ───────────────────────────────────────── */
.alert {
    padding: 12px 18px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500; margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ─── Pagination ──────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; padding: 20px; justify-content: center; }
.page-btn {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-muted);
    display: grid; place-items: center; font-size: 13.5px; font-weight: 600;
    cursor: pointer; transition: all .15s;
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .bottom-grid { grid-template-columns: 1fr; }
    .page-content { padding: 20px 16px; }
    .revenue-grid { grid-template-columns: 1fr 1fr; }
    .pipeline-steps { flex-wrap: wrap; gap: 8px; }
    .pipeline-arrow { display: none; }
    .track-info-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .revenue-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .track-info-grid { grid-template-columns: 1fr; }
}
