/* Explain: App-specific component classes. */
.card-surface {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-pad {
    padding: 1.25rem;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.page-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    max-width: 60ch;
    line-height: 1.7;
}

/* ---- Stat card ---- */
.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.15;
    font-family: var(--font-heading);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ---- Warehouse card ---- */
.wh-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wh-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mini-stat {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.mini-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.mini-value {
    font-size: 1.05rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

/* ---- Badge ---- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-soft);
    color: #15803d;
}

.badge-warning {
    background: var(--warning-soft);
    color: #b45309;
}

.badge-info {
    background: var(--info-soft);
    color: #1d4ed8;
}

.badge-danger {
    background: var(--danger-soft);
    color: #b91c1c;
}

/* ---- Table ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead th {
    text-align: start;
    padding: 0.75rem 0.9rem;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.77rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: #f8fafc;
}

.table-scroll {
    overflow-x: auto;
}

.num-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    white-space: nowrap;
}

.thumb-slot {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    overflow: hidden;
    flex-shrink: 0;
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Empty state ---- */
.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state i {
    font-size: 2rem;
    color: #cbd5e1;
    margin-bottom: 0.6rem;
    display: block;
}

/* ---- Forms ---- */
.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.field-input::placeholder,
.field-textarea::placeholder {
    color: #94a3b8;
}

/* ---- Buttons ---- */
.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s ease;
    min-height: 2.6rem;
}

.btn-primary-app {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary-app:hover {
    background: var(--primary-hover);
}

.btn-ghost-app {
    background: #fff;
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-ghost-app:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-success-app {
    background: var(--success-color);
    color: #fff;
}

.btn-success-app:hover {
    background: #15803d;
}

.btn-app:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon-app {
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    border: 1px solid transparent;
    color: #475569;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    transition: all 0.2s ease;
}

.btn-icon-app:hover {
    background: #e2e8f0;
    color: var(--text-color);
}

.btn-icon-danger:hover {
    background: var(--danger-soft);
    color: #b91c1c;
}

/* ---- Modal ---- */
.app-modal {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 30rem;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.app-modal::backdrop {
    background: rgba(15, 23, 42, 0.55);
}

.app-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.app-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.app-modal-body {
    padding: 1.25rem;
    max-height: 68vh;
    overflow-y: auto;
}

.app-modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

/* ---- Toast ---- */
.toast-app {
    position: fixed;
    bottom: 1.25rem;
    inset-inline-start: 1.25rem;
    z-index: 100;
    background: var(--secondary-color);
    color: #fff;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: all 0.25s ease;
    max-width: calc(100vw - 2.5rem);
}

.toast-app.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-app.is-error {
    background: var(--danger-color);
}

.toast-app.is-success {
    background: var(--success-color);
}