* { box-sizing: border-box; }
body { margin: 0; font-family: Tahoma, Arial, sans-serif; background: #f6f7fb; color: #1f2937; }
a { color: #334155; text-decoration: none; }
.topbar { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.5rem; background: #fff; border-bottom: 1px solid #e5e7eb; }
.topbar nav { display: flex; gap: .75rem; flex: 1; }
.container { width: min(1100px, calc(100% - 2rem)); margin: 2rem auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.page-header, .actions, .filters { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.page-header { justify-content: space-between; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1rem; box-shadow: 0 1px 2px rgb(15 23 42 / 6%); }
.auth-card { max-width: 420px; margin: 4rem auto; }
label { display: block; margin: .75rem 0; }
input, textarea { width: 100%; padding: .7rem; border: 1px solid #d1d5db; border-radius: 8px; margin-top: .35rem; }
textarea { min-height: 90px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem; border-bottom: 1px solid #e5e7eb; text-align: right; }
button, .button { display: inline-block; border: 0; border-radius: 8px; padding: .7rem 1rem; background: #111827; color: #fff; cursor: pointer; }
.secondary { background: #64748b; }
.inline { display: flex; align-items: center; gap: .5rem; }
.inline input { width: auto; }
.alert { padding: .75rem; background: #fee2e2; color: #991b1b; border-radius: 8px; }
.low-stock { background: #fff7ed; }

/* === Neumorphic Soft UI Additions (ERP Accounting) === */
.nm-card {
    background: #f0f3f7;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow:
        7px 7px 14px #d1d3d8,
        -7px -7px 14px #ffffff;
}

.nm-table {
    border-collapse: separate;
    border-spacing: 0 8px;
}

.nm-table thead th {
    background: #e5e7eb;
    border-radius: 10px;
    padding: .75rem;
}

.nm-table tbody tr {
    background: #f0f3f7;
    box-shadow:
        4px 4px 8px #d1d3d8,
        -4px -4px 8px #ffffff;
    border-radius: 10px;
}

.nm-table tbody td {
    padding: .75rem;
}

.nm-badge {
    padding: .35rem .65rem;
    border-radius: 10px;
    font-size: .78rem;
}

.nm-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.nm-badge.muted {
    background: #e2e8f0;
    color: #475569;
}

.nm-actions a {
    background: #f0f3f7;
    padding: .60rem 1rem;
    border-radius: 14px;
    box-shadow:
        4px 4px 8px #d1d3d8,
        -4px -4px 8px #ffffff;
    transition: .15s;
}

.nm-actions a:hover {
    transform: translateY(-2px);
}

/* === Neumorphic Journal Create Enhancements === */
.nm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem;
}
.nm-grid .full { grid-column: 1 / -1; }

.nm-input, .nm-select, .nm-textarea {
    background: #f0f3f7;
    border: 0;
    border-radius: 14px;
    padding: .75rem .9rem;
    box-shadow: inset 4px 4px 8px #d1d3d8, inset -4px -4px 8px #ffffff;
    outline: none;
}
.nm-textarea { min-height: 96px; resize: vertical; }

.nm-toolbar {
    display:flex;
    gap:.6rem;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    margin-top: 1rem;
}
.nm-toolbar .left, .nm-toolbar .right { display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; }

.nm-button {
    display:inline-flex;
    align-items:center;
    gap:.5rem;
    border:0;
    cursor:pointer;
    border-radius: 14px;
    padding: .65rem 1rem;
    background:#f0f3f7;
    color:#0f172a;
    box-shadow: 4px 4px 8px #d1d3d8, -4px -4px 8px #ffffff;
}
.nm-button.primary {
    background: linear-gradient(145deg, #111827, #0b1220);
    color:#fff;
    box-shadow: 6px 6px 12px rgba(15,23,42,.25), -6px -6px 12px rgba(255,255,255,.9);
}
.nm-button.danger { color:#991b1b; }

.nm-summary {
    display:flex;
    gap:1rem;
    flex-wrap:wrap;
    align-items:center;
    justify-content:flex-end;
    margin-top: .75rem;
}
.nm-pill {
    padding: .45rem .75rem;
    border-radius: 999px;
    background:#f0f3f7;
    box-shadow: inset 3px 3px 6px #d1d3d8, inset -3px -3px 6px #ffffff;
    font-size:.85rem;
    color:#334155;
}
.nm-pill.ok { color:#065f46; }
.nm-pill.bad { color:#991b1b; }

/* === Fix Neumorphic Page Header Alignment === */
.page__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.4rem;
}

.page__header > div:first-child {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.page__header .page__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
}

.page__header .page__actions a {
    white-space: nowrap;
}

/* Artian ERP Modern UI Additions */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css');

:root {
  --erp-primary-green: #4D6A4F;
  --erp-deep-forest: #2F4632;
  --erp-warm-beige: #E9DCC5;
  --erp-soft-white: #F7F5F0;
  --erp-calm-grey: #CFCFCF;
  --erp-terracotta: #C57055;
  --erp-mist-green: #93A49A;
  --erp-sidebar-width: 260px;
}

body.erp-body-layout {
  font-family: 'Vazir', sans-serif !important;
  background-color: var(--erp-soft-white);
  color: var(--erp-deep-forest);
  margin: 0;
  padding: 0;
  direction: rtl;
  display: flex;
  min-height: 100vh;
}

.erp-wrapper {
  display: flex;
  width: 100%;
}

.erp-sidebar {
  width: var(--erp-sidebar-width);
  background-color: var(--erp-deep-forest);
  color: var(--erp-soft-white);
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.erp-brand {
  padding: 20px;
  font-size: 1.25rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: var(--erp-warm-beige);
}

.erp-nav-menu {
  list-style: none;
  padding: 15px 0;
  margin: 0;
  overflow-y: auto;
  flex-grow: 1;
}

.erp-nav-item a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--erp-calm-grey);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.erp-nav-item a:hover,
.erp-nav-item.active a {
  background-color: var(--erp-primary-green);
  color: var(--erp-soft-white);
  border-right: 4px solid var(--erp-terracotta);
}

.erp-main-panel {
  margin-right: var(--erp-sidebar-width);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.erp-topbar {
  height: 60px;
  background-color: #fff;
  border-bottom: 1px solid var(--erp-calm-grey);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 999;
}

.erp-topbar-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--erp-deep-forest);
}

.erp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.erp-user-badge {
  background-color: var(--erp-warm-beige);
  color: var(--erp-deep-forest);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.erp-logout-btn {
  color: var(--erp-terracotta);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.erp-logout-btn:hover {
  text-decoration: underline;
}

.erp-content {
  padding: 25px;
  flex-grow: 1;
}

.erp-card-container {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--erp-calm-grey);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  padding: 20px;
  margin-bottom: 20px;
}

/* --- Responsive Sidebar & Mobile Styles --- */
.erp-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #2F4632;
    cursor: pointer;
    margin-left: 15px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.erp-menu-toggle:hover {
    background-color: rgba(77, 106, 79, 0.1);
}

.erp-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.erp-sidebar-overlay.show-overlay {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .erp-wrapper {
        display: block;
        position: relative;
    }

    .erp-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 999;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    }

    .erp-sidebar.show-sidebar {
        transform: translateX(0);
    }

    .erp-main-panel {
        width: 100%;
        margin-right: 0;
    }

    .erp-menu-toggle {
        display: inline-block;
    }

    .erp-topbar {
        display: flex;
        align-items: center;
        padding: 10px 15px;
    }
}

/* --- Responsive Layout Fix with !important --- */
.erp-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #2F4632;
    cursor: pointer;
    margin-left: 15px;
    padding: 5px 10px;
    border-radius: 4px;
}

.erp-sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    z-index: 9998 !important;
    display: none !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.erp-sidebar-overlay.show-overlay {
    display: block !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    .erp-wrapper {
        display: block !important;
    }

    .erp-sidebar {
        position: fixed !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        z-index: 9999 !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease-in-out !important;
        display: block !important;
    }

    .erp-sidebar.show-sidebar {
        transform: translateX(0) !important;
    }

    .erp-main-panel {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .erp-menu-toggle {
        display: inline-block !important;
    }
}

/* ==========================================================================
   Artian ERP - Specific Products Responsive Table & Card Improvements
   ========================================================================== */
.erp-products-card {
    padding: 0;
    overflow: hidden;
}

.erp-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.erp-products-table {
    width: 100%;
    border-collapse: collapse;
}

.erp-products-table th,
.erp-products-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--erp-calm-grey);
    text-align: right;
    vertical-align: middle;
}

.erp-products-table th {
    background: var(--erp-warm-beige);
    color: var(--erp-deep-forest);
    font-weight: 700;
}

.erp-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.erp-status-badge.is-active {
    background: rgba(77, 106, 79, 0.12);
    color: var(--erp-deep-forest);
}

.erp-status-badge.is-inactive {
    background: #f0ece4;
    color: #7a7a7a;
}

.erp-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.erp-inline-form {
    display: inline;
    margin: 0;
}

.erp-button-link-danger {
    background: none;
    border: 0;
    padding: 0;
    color: var(--erp-terracotta);
    cursor: pointer;
    font: inherit;
    transition: color 0.2s;
}

.erp-button-link-danger:hover {
    color: #a8563f;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .erp-page-header-responsive {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    .erp-mobile-full-button {
        width: 100%;
        text-align: center;
    }

    .erp-products-card {
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .erp-products-table,
    .erp-products-table thead,
    .erp-products-table tbody,
    .erp-products-table tr,
    .erp-products-table th,
    .erp-products-table td {
        display: block;
        width: 100%;
    }

    .erp-products-table thead {
        display: none;
    }

    .erp-products-table tr {
        background: #ffffff;
        border: 1px solid var(--erp-calm-grey);
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .erp-products-table td {
        border: 0;
        padding: 8px 0;
        text-align: right;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed rgba(0,0,0,0.05);
    }

    .erp-products-table td:last-child {
        border-bottom: 0;
        padding-top: 12px;
    }

    .erp-products-table td::before {
        content: attr(data-label) " :";
        display: inline-block;
        color: var(--erp-deep-forest);
        font-size: 13px;
        font-weight: 700;
        margin-left: 10px;
    }

    .erp-row-actions {
        gap: 15px;
        justify-content: flex-start;
    }

}
/* Custom Additions for Inventory Status Rows */
.erp-row-low-stock {
    background-color: #fffaf5 !important;
    border-right: 4px solid var(--erp-terracotta) !important;
}

@media (max-width: 768px) {
    .erp-products-table tr.erp-row-low-stock {
        border: 1px solid var(--erp-terracotta) !important;
        border-right: 5px solid var(--erp-terracotta) !important;
        background-color: #fffaf5 !important;
    }
}
