* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: #1f2937;
    background: #f6f7f9;
}

a {
    color: inherit;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #edf4ee 0, transparent 40%),
        #f6f7f9;
}

.login-wrapper {
    width: 100%;
    max-width: 430px;
}

.login-panel {
    padding: 40px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .08);
}

.login-logo,
.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: #174a32;
    color: #fff;
    font-weight: 800;
}

.login-panel h1 {
    margin: 20px 0 6px;
}

.login-subtitle {
    margin: 0 0 28px;
    color: #6b7280;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 650;
}

.form-group input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    background: #fff;
}

.form-group input:focus {
    border-color: #174a32;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 13px 18px;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: #174a32;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
}

.alert-error {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    background: #102a20;
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 24px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    margin-top: 3px;
    color: #b9c8c0;
    font-size: 11px;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-nav a {
    padding: 12px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #d9e4de;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.sidebar-user {
    margin-top: auto;
    padding: 18px 10px 4px;
    border-top: 1px solid rgba(255,255,255,.12);
}

.sidebar-user-name {
    font-weight: 700;
}

.sidebar-user-role {
    margin: 3px 0 14px;
    color: #a9bbb1;
    font-size: 12px;
}

.logout-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.main-content {
    width: calc(100% - 250px);
    margin-left: 250px;
    padding: 34px;
}

.page-header h1 {
    margin: 0 0 7px;
}

.page-header p {
    margin: 0;
    color: #6b7280;
}

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

.dashboard-card {
    display: block;
    padding: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(15,23,42,.04);
}

.dashboard-card:hover {
    transform: translateY(-1px);
}

.dashboard-card .card-label {
    display: block;
    margin-bottom: 14px;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.dashboard-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 19px;
}

.dashboard-card small {
    color: #6b7280;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .sidebar {
        width: 210px;
    }

    .main-content {
        width: calc(100% - 210px);
        margin-left: 210px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* CATEGORY CRUD */
.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 26px;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    text-decoration: none;
}

.btn-danger {
    background: #b42318;
    color: #fff;
}

.btn-small {
    padding: 8px 11px;
    font-size: 12px;
}

.table-card,
.form-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15,23,42,.04);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 930px;
}

.data-table th,
.data-table td {
    padding: 15px 16px;
    border-bottom: 1px solid #edf0f2;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.text-right {
    text-align: right !important;
}

.table-subtext {
    margin-top: 3px;
    color: #9ca3af;
    font-size: 11px;
}

.category-thumb {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    display: block;
}

.category-thumb-empty {
    display: grid;
    place-items: center;
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 9px;
    text-align: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-yes {
    background: #ecfdf3;
    color: #166534;
}

.status-no {
    background: #f3f4f6;
    color: #6b7280;
}

.status-neutral {
    background: #eff6ff;
    color: #1d4ed8;
}

.action-cell {
    white-space: nowrap;
}

.inline-form {
    display: inline-block;
    margin-left: 5px;
}

.empty-state {
    padding: 46px !important;
    text-align: center !important;
    color: #6b7280;
}

.form-card {
    padding: 28px;
    max-width: 980px;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    background: #fff;
    font: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group select:focus,
.form-group textarea:focus {
    border-color: #174a32;
}

.required {
    color: #b42318;
}

.image-preview-wrap {
    margin-top: 12px;
}

.image-preview {
    width: 220px;
    height: 145px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    object-fit: cover;
    display: block;
}

.is-hidden {
    display: none !important;
}

.switch-row {
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
    margin: 12px 0 24px;
}

.check-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.check-field input {
    width: 17px;
    height: 17px;
}

.form-section-title {
    margin: 28px 0 18px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 760px) {
    .page-header-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 20px;
    }
}

/* PRODUCT CRUD */
.product-table {
    min-width: 1180px;
}

.filter-card {
    margin-bottom: 18px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15,23,42,.03);
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.filter-group {
    margin-bottom: 0;
}

.filter-actions {
    display: flex;
    gap: 8px;
    padding-bottom: 1px;
}

.flag-stack {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.product-form-card {
    max-width: 1100px;
}

.form-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin: 30px 0 18px;
    padding-top: 26px;
    border-top: 1px solid #e5e7eb;
}

.form-section-heading:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.form-section-heading h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

.form-section-heading p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}

.product-main-preview {
    width: 260px;
    height: 190px;
}

.product-switch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 20px;
    margin-top: 8px;
}

.repeater-block {
    margin-top: 18px;
    padding: 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 14px;
}

.repeater-list {
    display: grid;
    gap: 10px;
}

.repeater-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.repeater-grow {
    flex: 1;
}

.repeater-row input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    outline: none;
    background: #fff;
    font: inherit;
}

.repeater-row input:focus {
    border-color: #174a32;
}

.specification-list {
    padding: 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.repeater-form-group {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

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

    .product-switch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .form-section-heading,
    .repeater-header,
    .repeater-row {
        align-items: stretch;
        flex-direction: column;
    }

    .product-switch-grid {
        grid-template-columns: 1fr;
    }
}

/* INQUIRY MANAGEMENT */
.inquiry-table {
    min-width: 1150px;
}

.inquiry-filter-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.5fr) minmax(180px, .8fr) minmax(180px, .8fr) auto;
    gap: 14px;
    align-items: end;
}

.inquiry-status-new {
    background: #fff7ed;
    color: #9a3412;
}

.inquiry-status-contacted {
    background: #eff6ff;
    color: #1d4ed8;
}

.inquiry-status-discussion {
    background: #faf5ff;
    color: #7e22ce;
}

.inquiry-status-completed {
    background: #ecfdf3;
    color: #166534;
}

.inquiry-status-closed {
    background: #f3f4f6;
    color: #4b5563;
}

.back-link {
    display: inline-block;
    margin-bottom: 9px;
    color: #5b6b63;
    font-size: 13px;
    text-decoration: none;
}

.back-link:hover {
    color: #174a32;
}

.inquiry-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, .75fr);
    gap: 22px;
    margin-top: 24px;
    align-items: start;
}

.inquiry-detail-main {
    display: grid;
    gap: 20px;
}

.detail-card {
    padding: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15,23,42,.03);
}

.detail-card-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    padding-bottom: 17px;
    border-bottom: 1px solid #e5e7eb;
}

.detail-card-header h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

.detail-card-header p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.45;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.detail-item {
    min-width: 0;
}

.detail-item span,
.message-box > span {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.detail-item strong,
.detail-item a {
    display: block;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.55;
}

.detail-item a {
    color: #174a32;
}

.message-box {
    margin-top: 22px;
    padding: 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.message-box p {
    margin: 0;
    line-height: 1.7;
    color: #374151;
}

.sticky-card {
    position: sticky;
    top: 24px;
}

@media (max-width: 1050px) {
    .inquiry-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .inquiry-detail-grid {
        grid-template-columns: 1fr;
    }

    .sticky-card {
        position: static;
    }
}

@media (max-width: 650px) {
    .inquiry-filter-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* DASHBOARD STATISTICS */
.dashboard-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dashboard-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-alert {
    margin-top: 22px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.stat-card {
    min-height: 162px;
    padding: 22px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(15,23,42,.035);
    transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15,23,42,.07);
}

.stat-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #eef6f1;
    color: #174a32;
    font-weight: 800;
}

.stat-label {
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
}

.stat-value {
    display: block;
    margin: 18px 0 6px;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -.04em;
}

.stat-card small {
    color: #6b7280;
    line-height: 1.45;
}

.stat-card-attention .stat-icon {
    background: #fff7ed;
    color: #c2410c;
}

.stat-card-success .stat-icon {
    background: #ecfdf3;
    color: #166534;
}

.dashboard-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 18px;
    margin-top: 18px;
}

.dashboard-panel {
    padding: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 7px 20px rgba(15,23,42,.03);
}

.dashboard-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-panel-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.dashboard-panel-header p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}

.dashboard-panel-header > a {
    color: #174a32;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.status-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.status-summary-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 12px 13px;
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
}

.status-summary-item:hover {
    background: #f9fafb;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #9ca3af;
}

.status-dot-new { background: #f97316; }
.status-dot-contacted { background: #3b82f6; }
.status-dot-discussion { background: #a855f7; }
.status-dot-completed { background: #22c55e; }
.status-dot-closed { background: #9ca3af; }

.inquiry-type-summary {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.inquiry-type-summary h3 {
    margin: 0 0 12px;
    font-size: 14px;
}

.type-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-pill {
    display: inline-flex;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    text-decoration: none;
    font-size: 12px;
}

.type-pill strong {
    color: #111827;
}

.category-breakdown-list {
    display: grid;
    gap: 16px;
}

.category-breakdown-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 7px;
    font-size: 13px;
}

.category-breakdown-track {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: #edf0ee;
}

.category-breakdown-fill {
    height: 100%;
    border-radius: inherit;
    background: #2f6b4b;
}

.recent-inquiries-panel {
    margin-top: 18px;
}

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf0f2;
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

.dashboard-table th {
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dashboard-table td strong,
.dashboard-table td small {
    display: block;
}

.dashboard-table td small {
    margin-top: 3px;
    color: #6b7280;
}

.dashboard-type-badge {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
}

.dashboard-row-action {
    text-align: right !important;
}

.dashboard-row-action a {
    color: #174a32;
    font-weight: 700;
    text-decoration: none;
}

.empty-dashboard-state {
    padding: 26px 10px;
    color: #6b7280;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 1050px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .dashboard-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid,
    .status-summary-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: auto;
    }
}
