:root {
    --roto-dark: #0e0d1c;
    --roto-blue-dark: #19254f;
    --roto-blue-light: #224082;
    --roto-orange: #f37321;
    --portal-bg: #f4f6fa;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-soft: #e7ebf1;
    --row-hover: #eaf2ff;
    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-light: 0 4px 18px rgba(15, 23, 42, 0.06);
    --radius-lg: 16px;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--portal-bg);
    color: var(--text-main);
}

/* ---------- BASE / LAYOUT ---------- */

.portal-body {
    background: var(--portal-bg);
}

.portal-header {
    background: linear-gradient(135deg, var(--roto-dark) 0%, var(--roto-blue-dark) 55%, var(--roto-blue-light) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 18px 28px;
    margin-bottom: 0;
}

.portal-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.portal-branding {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.portal-logo {
    height: 54px;
    width: auto;
    display: block;
}

.portal-brand-text {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.portal-title {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: 0.2px;
}

.portal-company {
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    font-weight: 400;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    transition: all 0.2s ease;
}

.portal-nav-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    transform: translateY(-1px);
}

.portal-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 34px 28px 48px;
}

.profile-icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-icon-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.profile-icon {
    font-size: 1.45rem;
    color: #ffffff;
    line-height: 1;
}

.profile-menu {
    display: none;
    position: absolute;
    top: 52px;
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    z-index: 999;
}

.profile-menu a,
.profile-header {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.95rem;
}

.profile-menu a:hover {
    background: #f8fafc;
}

.profile-header {
    font-weight: 700;
    background: #f8fafc;
}

.profile-logout-btn {
    background: none;
    border: none;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.95rem;
}

.profile-logout-btn:hover {
    background: #f8fafc;
}

.portal-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--roto-dark);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-soft);
}

.toast-visible {
    opacity: 1;
}

.toast-hidden {
    opacity: 0;
}

.portal-modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: var(--shadow-soft);
}

/* ---------- DASHBOARD ---------- */

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-page-title {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 500;
    color: var(--text-main);
}

.dashboard-page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.dashboard-stat-line {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 8px;
    margin-bottom: 18px;
    line-height: 1.4;
}

.dashboard-stat-line strong {
    font-weight: 600;
    color: var(--text-main);
}

.portal-primary-btn,
.portal-secondary-btn,
.portal-ghost-btn,
.portal-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
}

.portal-primary-btn {
    background: var(--roto-orange);
    color: #fff;
    padding: 12px 20px;
    border: 1px solid var(--roto-orange);
    box-shadow: none;
    transition: none;
}

.portal-primary-btn:hover,
.portal-primary-btn:focus,
.portal-primary-btn:active {
    background: var(--roto-orange);
    border-color: var(--roto-orange);
    color: #fff;
    transform: none;
    box-shadow: none;
    text-decoration: none;
}

.portal-secondary-btn {
    background: var(--roto-blue-light);
    color: #fff;
    border: 1px solid var(--roto-blue-light);
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.portal-secondary-btn:hover {
    background: var(--roto-blue-dark);
    border-color: var(--roto-blue-dark);
    color: #fff;
}

.portal-ghost-btn {
    background: #fff;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.portal-ghost-btn:hover {
    background: #f9fafb;
    color: var(--text-main);
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-light);
}

.dashboard-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--roto-blue-dark);
    line-height: 1;
    margin-bottom: 8px;
}

.dashboard-stat-label {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
    padding: 24px;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-card-header-stack {
    align-items: flex-start;
    flex-wrap: wrap;
}

.dashboard-card-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.dashboard-card-subtitle {
    margin: 6px 0 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ---------- FILTERS ---------- */

.filter-card-modern {
    padding: 20px;
    background: #dcdcdc;
    border: 1px solid #d2d7de;
    box-shadow: none;
}

.filter-card-modern .portal-input {
    background: #ffffff;
}

.portal-input {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    color: var(--text-main);
    padding: 10px 14px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.portal-input:focus {
    border-color: var(--roto-blue-light);
    box-shadow: 0 0 0 4px rgba(34, 64, 130, 0.12);
}

.filter-form-inline-modern {
    display: block;
    width: 100%;
}

.filter-inline-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    width: 100%;
}

.filter-inline-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-inline-item label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: block;
}

.filter-inline-search {
    position: relative;
    flex: 1.3 1 280px;
    min-width: 280px;
}

.filter-inline-search .portal-input {
    width: 100%;
    padding-right: 42px;
}

.filter-inline-search .clear-search-modern {
    position: absolute;
    right: 10px;
    bottom: 10px;
    top: auto;
    transform: none;
}

.filter-inline-select {
    flex: 0 0 170px;
    min-width: 170px;
}

.filter-inline-date {
    flex: 0 0 190px;
    min-width: 190px;
}

.filter-inline-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding-bottom: 1px;
    flex-wrap: wrap;
}

.filter-inline-actions .portal-secondary-btn,
.filter-inline-actions .portal-ghost-btn {
    min-height: 46px;
}

/* ---------- SEARCH ---------- */

.product-list-shell {
    width: 0;
    max-width: 0;
    overflow: hidden;
}

.search-wrapper-modern {
    position: relative;
}

.search-input-modern {
    padding-right: 44px;
}

.clear-search-modern {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #eef2f7;
    color: #334155;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

.clear-search-modern:hover {
    background: #e2e8f0;
}

/* ---------- TABLE ---------- */

.product-table-card {
    overflow: hidden;
}

.product-table-modern {
    width: 100%;
    background: #eef1f5;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.product-table-modern thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #e9edf3;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 800;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.product-table-modern tbody td {
    padding: 18px 20px;
    border-bottom: 1px solid #dde5ee;
    vertical-align: middle;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: background-color 0.15s ease;
}

.product-table-modern tbody tr:nth-child(odd) td {
    background: #ffffff;
}

.product-table-modern tbody tr:nth-child(even) td {
    background: #dedede;
}

.product-table-modern tbody tr:hover td {
    background: var(--row-hover);
}

.sort-btn {
    background: none;
    border: none;
    padding: 0;
    font-weight: 800;
    color: inherit;
    cursor: pointer;
}

.sort-btn:hover {
    color: var(--roto-blue-light);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    white-space: nowrap;
    color: #9ca3af;
}

.table-actions a {
    color: #1f2937;
    text-decoration: none;
    font-size: inherit;
    font-weight: inherit;
}

.table-actions a:hover {
    text-decoration: underline;
}

.table-actions .action-copy {
    color: #f97316;
    font-weight: 600;
}

.table-actions a:last-child {
    color: #6b7280;
}

.empty-state-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 28px !important;
}

.empty-dashboard-card {
    text-align: center;
}

.empty-dashboard-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
}

/* ---------- PAGINATION ---------- */

.pagination-modern {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.portal-page-btn {
    background: #fff;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.portal-page-btn:hover {
    background: #f8fafc;
    color: var(--text-main);
}

.pagination-info {
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 8px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1200px) {
    .filter-inline-row {
        align-items: stretch;
    }

    .filter-inline-search,
    .filter-inline-select,
    .filter-inline-date,
    .filter-inline-actions {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .filter-inline-actions {
        padding-bottom: 0;
    }
}

@media (max-width: 992px) {
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }

    .portal-main {
        padding: 24px 18px 36px;
    }

    .portal-header {
        padding: 16px 18px;
    }

    .portal-header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-nav {
        width: 100%;
        flex-wrap: wrap;
    }

    .dashboard-page-title {
        font-size: 1.6rem;
    }
}

@media (max-width: 640px) {
    .dashboard-card,
    .dashboard-stat-card {
        padding: 18px;
    }

    .dashboard-topbar {
        align-items: stretch;
    }

    .dashboard-topbar .portal-primary-btn {
        margin-top: 8px;
    }

    .portal-primary-btn {
        padding: 10px 18px;
        font-weight: 600;
    }

    .table-actions {
        gap: 8px;
    }
}

/* =========================================
   CREATE PRODUCT PAGE
   ========================================= */

.create-product-card {
    padding: 28px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 18px;
    align-items: start;
}

.form-row-single {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-field label,
.form-row-single label {
    display: block;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.form-field input,
.form-field select,
.form-field textarea,
.form-row-single input,
.form-row-single select,
.form-row-single textarea {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    border: 1px solid #c2c9d3;
    background: #ffffff;
    color: var(--text-main);
    padding: 10px 14px;
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.form-row-single input:focus,
.form-row-single select:focus,
.form-row-single textarea:focus {
    border-color: var(--roto-blue-light);
    box-shadow: 0 0 0 4px rgba(34, 64, 130, 0.12);
}

.form-field textarea,
.form-row-single textarea {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-start;
}

/* optional nicer spacing for the top search field */
.form-row-single:first-child {
    max-width: 420px;
}

/* mobile */
@media (max-width: 900px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .create-product-card {
        padding: 20px;
    }
}

/* ---------- PRELOADED PRODUCT SEARCH ---------- */

.preloaded-search-row {
    max-width: 460px;
}

.preloaded-search-wrap {
    position: relative;
    width: 100%;
}

.suggestions-box {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #c2c9d3;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    border-bottom: 1px solid #eef2f7;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f8fafc;
}

.form-error {
    font-size: 0.85rem;
    color: #dc2626;
    margin-top: 4px;
}

/* Adjust textarea height */

#id_description {
    height: 100px !important;
}

#id_notes {
    height: 90px !important;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.dpp-value a {
  color: #ffffff;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  text-decoration: none;
}

.dpp-value a:hover {
  color: #f37321;
  border-bottom: 1px solid #f37321;
}
