/* =====================================================================
   ENET Warehouse — Design System
   ===================================================================== */

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

:root {
    /* Surfaces */
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #fafaf9;
    --surface-hover: #f5f5f4;

    /* Borders */
    --border: #e7e5e4;
    --border-strong: #d6d3d1;

    /* Text */
    --text: #1c1917;
    --text-2: #57534e;
    --text-3: #a8a29e;

    /* ENET brand (red) — used as accent, not primary action */
    --brand: #e02424;
    --brand-dark: #b91c1c;
    --brand-bg: #fef2f2;

    /* Primary action = dark slate (neutral, professional) */
    --primary: #1c1917;
    --primary-hover: #0c0a09;
    --primary-fg: #ffffff;

    /* Functional colors */
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --green: #15803d;
    --green-bg: #f0fdf4;
    --green-dark: #166534;
    --amber: #b45309;
    --amber-bg: #fffbeb;
    --red: #dc2626;
    --red-bg: #fef2f2;

    /* Radii */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);

    /* Tap target minimum */
    --tap: 44px;
}

/* =====================================================================
   Reset & base
   ===================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    font-feature-settings: 'cv11';
}

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

code, .mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-size: 0.95em; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

/* =====================================================================
   Header / navigation
   ===================================================================== */

.enet-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.enet-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
}

.enet-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}
.enet-brand:hover { text-decoration: none; }

.enet-brand img {
    height: 36px;
    width: auto;
    display: block;
}

.enet-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}
.enet-brand-text .title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.enet-brand-text .subtitle {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

.enet-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.enet-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.enet-nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.enet-nav a.active { background: var(--text); color: #fff; }

.enet-nav-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.enet-user {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-2);
    padding: 6px 12px;
    background: var(--surface-2);
    border-radius: 999px;
    border: 1px solid var(--border);
}
.enet-user .role {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand);
    background: var(--brand-bg);
    padding: 2px 7px;
    border-radius: 999px;
}

.enet-nav .danger { color: var(--red); }
.enet-nav .danger:hover { background: var(--red-bg); color: var(--red); }

/* Mobile hamburger */
.enet-hamburger {
    display: none;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}
.enet-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* Drawer overlay */
.enet-drawer {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.enet-drawer.open { opacity: 1; pointer-events: auto; }

.enet-drawer-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}
.enet-drawer.open .enet-drawer-panel { transform: translateX(0); }

.enet-drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.enet-drawer-header h3 { font-size: 14px; font-weight: 600; }
.enet-drawer-close {
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    color: var(--text-2); padding: 4px 8px;
}
.enet-drawer-body { padding: 12px; flex: 1; overflow-y: auto; }
.enet-drawer a {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    border-radius: var(--radius-sm);
}
.enet-drawer a:hover { background: var(--surface-hover); text-decoration: none; }
.enet-drawer a.active { background: var(--text); color: #fff; }
.enet-drawer a.danger { color: var(--red); }
.enet-drawer-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-2);
    background: var(--surface-2);
}
.enet-drawer-footer .name { font-weight: 600; color: var(--text); margin-bottom: 2px; }

/* =====================================================================
   Layout
   ===================================================================== */

.enet-container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; }
.enet-container.narrow { max-width: 720px; }
.enet-container.medium { max-width: 960px; }

.page-head {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.page-head h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.page-head .sub { font-size: 14px; color: var(--text-2); margin-top: 4px; }

/* =====================================================================
   Cards
   ===================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.card.accent { border-top: 3px solid var(--brand); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-2);
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* =====================================================================
   Badges
   ===================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-neutral { background: var(--surface-hover); color: var(--text-2); }
.badge-success { background: var(--green-bg); color: var(--green-dark); }
.badge-warning { background: var(--amber-bg); color: var(--amber); }
.badge-error   { background: var(--red-bg); color: var(--red); }
.badge-info    { background: var(--blue-bg); color: var(--blue); }
.badge-brand   { background: var(--brand-bg); color: var(--brand-dark); }

/* =====================================================================
   Buttons
   ===================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--tap);
    padding: 0 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    white-space: nowrap;
    line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--green-dark); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--brand-dark); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--text-2); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; font-size: 18px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }

/* =====================================================================
   Forms
   ===================================================================== */

.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 540px) { .field-row { grid-template-columns: 1fr; gap: 0; }
    .field-row > .field { margin-bottom: 16px; } }

.field label, .label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.input, select.input, textarea.input,
.field input, .field select, .field textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font: inherit;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.08);
}

textarea.input, .field textarea { min-height: 72px; resize: vertical; }
select.input, .field select { cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2357534e' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* Photo upload */
.photo-upload {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
    background: var(--surface-2);
}
.photo-upload:hover { border-color: var(--text-2); background: var(--surface-hover); }
.photo-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-upload .icon { font-size: 28px; }
.photo-upload .text { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.photo-preview { margin-top: 12px; }
.photo-preview img { max-width: 100%; max-height: 240px; border-radius: var(--radius-sm); display: block; }

/* =====================================================================
   Status messages
   ===================================================================== */

.status {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
    border: 1px solid transparent;
}
.status.show { display: flex; align-items: center; gap: 10px; }
.status-success { background: var(--green-bg); color: var(--green-dark); border-color: #bbf7d0; }
.status-error   { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.status-info    { background: var(--blue-bg); color: var(--blue); border-color: #bfdbfe; }
.status-warning { background: var(--amber-bg); color: var(--amber); border-color: #fde68a; }

/* =====================================================================
   Data rows (key/value)
   ===================================================================== */

.data-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}
.data-row:last-child { border-bottom: none; }
.data-label { width: 140px; font-size: 13px; color: var(--text-2); flex-shrink: 0; padding-top: 1px; }
.data-value { font-size: 14px; color: var(--text); font-weight: 500; flex: 1; word-break: break-word; }
@media (max-width: 480px) {
    .data-row { flex-direction: column; gap: 2px; padding: 8px 0; }
    .data-label { width: auto; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
}

/* =====================================================================
   Tables  (responsive: convert to cards on narrow screens)
   ===================================================================== */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-2);
    color: var(--text-2);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:first-child td { border-top: none; }
.table tbody tr:hover { background: var(--surface-2); }

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 14px;
}

/* =====================================================================
   Stats grid
   ===================================================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--text);
}
.stat-card.accent::before { background: var(--brand); }
.stat-card.success::before { background: var(--green); }
.stat-card.warning::before { background: var(--amber); }
.stat-card.danger::before { background: var(--red); }

.stat-num {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 6px;
    font-weight: 500;
}
.stat-num.success { color: var(--green-dark); }
.stat-num.danger { color: var(--red); }

/* =====================================================================
   Progress
   ===================================================================== */

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    min-width: 80px;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}
.fill-green { background: var(--green); }
.fill-blue  { background: var(--blue); }
.fill-amber { background: var(--amber); }
.fill-red   { background: var(--red); }

/* =====================================================================
   Tabs
   ===================================================================== */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--surface);
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.tab {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.tab:hover { background: var(--surface-hover); color: var(--text); }
.tab.active { background: var(--text); color: #fff; }

/* =====================================================================
   Section title
   ===================================================================== */

.section { margin-bottom: 28px; }
.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* =====================================================================
   Loading
   ===================================================================== */

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
    font-size: 14px;
}
.loading::before {
    content: '';
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--text-2);
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: -3px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Utilities
   ===================================================================== */

.text-muted { color: var(--text-2); }
.text-faint { color: var(--text-3); }
.text-strong { color: var(--text); font-weight: 600; }
.text-success { color: var(--green-dark); }
.text-danger { color: var(--red); }
.text-warning { color: var(--amber); }

.hide-mobile { }
.show-mobile { display: none; }

/* =====================================================================
   Mobile breakpoints
   ===================================================================== */

@media (max-width: 860px) {
    .enet-nav, .enet-nav-divider, .enet-user { display: none; }
    .enet-hamburger { display: flex; }
    .hide-mobile { display: none !important; }
    .show-mobile { display: revert; }
    .page-head h1 { font-size: 22px; }
    .enet-container { padding: 16px 14px 80px; }
    .enet-header-inner { padding: 8px 14px; min-height: 56px; }
    .enet-brand img { height: 30px; }
    .enet-brand-text { padding-left: 12px; }
    .enet-brand-text .title { font-size: 13px; }
    .enet-brand-text .subtitle { font-size: 10px; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    .card-body { padding: 16px; }
    .card-header { padding: 14px 16px; }
    .stat-num { font-size: 24px; }
    .enet-brand-text { display: none; }
}
