:root {
    --bg: #fdf8f2;
    --surface: #ffffff;
    --surface2: #f5ede0;
    --border: #e8d9c5;
    --accent: #e85d26;
    --accent2: #f5a623;
    --accent3: #3a7d44;
    --text: #1a1208;
    --text2: #6b5744;
    --text3: #a0876e;
    --shadow: 0 2px 12px rgba(26,18,8,0.08);
    --shadow-lg: 0 8px 32px rgba(26,18,8,0.12);
    --radius: 14px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image: radial-gradient(circle at 20% 80%, rgba(232,93,38,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245,166,35,0.08) 0%, transparent 50%);
}

.app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 240px;
    background: var(--text);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 28px 0;
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
    z-index: 100;
}

.logo {
    padding: 0 24px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}
.logo h1 { font-family: 'DM Serif Display', serif; font-size: 22px; letter-spacing: -0.5px; color: white; }
.logo span { color: var(--accent2); }
.logo p { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 3px; font-family: 'DM Mono', monospace; letter-spacing: 0.5px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: white; border-left-color: var(--accent2); background: rgba(255,255,255,0.08); }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    margin-top: auto;
    padding: 20px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    font-family: 'DM Mono', monospace;
}

/* MAIN */
.main { margin-left: 240px; flex: 1; padding: 36px 40px; }

/* PAGE HEADER */
.page-header { margin-bottom: 32px; }
.page-header h2 { font-family: 'DM Serif Display', serif; font-size: 32px; color: var(--text); letter-spacing: -0.5px; }
.page-header p { color: var(--text3); font-size: 14px; margin-top: 4px; }

/* STAT CARDS */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 32px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.orange::before { background: var(--accent); }
.stat-card.yellow::before { background: var(--accent2); }
.stat-card.green::before { background: var(--accent3); }
.stat-card.blue::before { background: #4a90d9; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 8px; font-family: 'DM Mono', monospace; }
.stat-value { font-family: 'DM Serif Display', serif; font-size: 36px; color: var(--text); letter-spacing: -1px; }
.stat-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* CARD */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 16px; font-weight: 800; }

/* TABLE */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text3); background: var(--surface2); font-family: 'DM Mono', monospace; }
td { padding: 14px 20px; font-size: 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fdf5ec; }

/* BADGES */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; font-family: 'DM Mono', monospace; }
.badge-green { background: #d4edda; color: #2d6a4f; }
.badge-orange { background: #ffe8d6; color: #c44b0b; }
.badge-red { background: #fde; color: #c0392b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f0ece8; color: var(--text3); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; cursor: pointer; border: none; transition: all 0.18s; font-family: 'Nunito', sans-serif; text-decoration: none; appearance: none; -webkit-appearance: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #c94d1a; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,93,38,0.35); }
.btn-secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--accent3); color: white; }
.btn-success:hover { background: #2d6a4f; }
.btn-danger { background: #fde; color: #c0392b; border: 1px solid #f5c6cb; }
.btn-danger:hover { background: #f5c6cb; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { transform: none; box-shadow: none; }
/* Bootstrap (also loaded, see layouts/app.blade.php) ships its own
   .btn-primary:disabled rule with the same specificity as a plain
   .btn-primary here, and since it loads before app.css it normally loses —
   except our .btn-primary never redeclared background for the :disabled
   state specifically, so Bootstrap's rule was the only one left claiming
   it (Bootstrap blue instead of this app's orange). ".btn.btn-primary"
   outranks Bootstrap's single-class selector regardless of load order. */
.btn.btn-primary:disabled { background: var(--accent); }

/* FORMS */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text2); font-family: 'DM Mono', monospace; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.18s;
    width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

/* CHECKBOXES */
input[type="checkbox"] {
    border: 2px solid var(--text3);
    border-radius: 3px;
    cursor: pointer;
}

/* ALERTS */
.alert { padding: 12px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; margin-bottom: 20px; }
.alert-success { background: #d4edda; color: #2d6a4f; border: 1px solid #b8ddc8; }
.alert-error { background: #fde; color: #c0392b; border: 1px solid #f5c6cb; }

/* TOOLBAR */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; flex: 1; min-width: 180px; }

/* EMPTY STATE */
.empty { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* TRANSACTION LIST */
.tx-item { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.tx-item:last-child { border-bottom: none; }
.tx-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tx-icon.in { background: #d4edda; }
.tx-icon.out { background: #fde; }
.tx-icon.adj { background: #dbeafe; }
.tx-meta { flex: 1; }
.tx-meta strong { display: block; font-size: 14px; margin-bottom: 2px; }
.tx-meta span { font-size: 12px; color: var(--text3); }
.tx-qty { font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 500; }
.tx-qty.positive { color: var(--accent3); }
.tx-qty.negative { color: var(--accent); }
