/* ============================================================
   MAILWOK DASHBOARD STYLES — Light/Dark Theme
   Inter font · Pill elements · Generous spacing
   ============================================================ */

/* ── Dashboard Shell ── */
.dash-shell * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.dash-shell {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ── Blinking Logo Dot ── */
.logo-dot {
    color: #FF5A28;
    display: inline-block;
    animation: blinkDot 2s ease-in-out infinite;
}

@keyframes blinkDot {

    0%,
    100% {
        opacity: 1;
        text-shadow: 0 0 6px rgba(255, 90, 40, 0.6);
    }

    50% {
        opacity: 0.2;
        text-shadow: none;
    }
}

/* ── Sidebar ── */
.d-sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: background 0.3s ease;
}

.d-sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, transparent 0%, rgba(255, 90, 40, 0.02) 100%);
}

.d-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.d-sidebar-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(255, 90, 40, 0.2);
}

.d-sidebar-logo span {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

.d-sidebar-logo strong {
    font-weight: 800;
    color: var(--text-primary);
}

.d-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 0;
}

.d-nav-section {
    padding: 0 12px;
    margin-bottom: 4px;
}

.d-nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 16px 14px 8px;
}

.d-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    font-weight: 500;
    position: relative;
}

.d-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.d-nav-item.active {
    background: var(--orange-light);
    color: #FF5A28;
    font-weight: 600;
}

.d-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}

.d-nav-item.active svg {
    opacity: 1;
}

.d-nav-badge {
    background: #FF5A28;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 100px;
    margin-left: auto;
}

.d-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.d-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.d-sidebar-user:hover {
    background: var(--bg-tertiary);
}

.d-sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF5A28, #ff8a5c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.d-sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.d-sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.d-sidebar-user-plan {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Main ── */
.d-main {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.d-header {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background 0.3s ease;
}

.d-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.d-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.d-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.d-header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 8px 16px;
    width: 260px;
}

.d-header-search input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    outline: none;
}

.d-header-search input::placeholder {
    color: var(--text-muted);
}

.d-header-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.d-header-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.d-header-icon .notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #FF5A28;
    border: 2px solid var(--bg-primary);
}

.d-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Theme toggle in dashboard */
.d-theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 16px;
}

.d-theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ── Content ── */
.d-content {
    flex: 1;
    padding: 28px;
}

.d-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.d-page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

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

.d-page-actions {
    display: flex;
    gap: 10px;
}

/* ── Cards ── */
.d-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.d-card:hover {
    border-color: var(--border-light);
}

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

.d-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Stat Cards ── */
.d-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.d-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

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

.d-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.d-stat-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.d-stat-change {
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

.d-stat-change.up {
    color: #16A34A;
}

.d-stat-change.down {
    color: #DC2626;
}

/* ── Buttons ── */
.d-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: 100px;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.d-btn-primary {
    background: #FF5A28;
    color: #fff;
}

.d-btn-primary:hover {
    background: #e84d1e;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 90, 40, 0.25);
}

.d-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

.d-btn-secondary:hover {
    background: var(--card-hover);
    border-color: var(--border-light);
}

.d-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.d-btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.d-btn-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.d-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ── Tables ── */
.d-table {
    width: 100%;
    border-collapse: collapse;
}

.d-table thead tr {
    border-bottom: 1px solid var(--border);
}

.d-table thead th {
    padding: 14px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.d-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.d-table tbody tr:hover {
    background: var(--card-hover);
}

.d-table tbody td {
    padding: 16px 18px;
    font-size: 13px;
    color: var(--text-secondary);
}

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

/* ── Badges ── */
.d-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.d-badge-green {
    background: rgba(22, 163, 74, 0.1);
    color: #16A34A;
}

.d-badge-red {
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
}

.d-badge-yellow {
    background: rgba(217, 119, 6, 0.1);
    color: #D97706;
}

.d-badge-blue {
    background: rgba(37, 99, 235, 0.1);
    color: #2563EB;
}

.d-badge-purple {
    background: rgba(147, 51, 234, 0.1);
    color: #9333EA;
}

.d-badge-orange {
    background: rgba(255, 90, 40, 0.1);
    color: #FF5A28;
}

.d-badge-gray {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

/* ── Tabs ── */
.d-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.d-tab {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.d-tab:hover {
    color: var(--text-primary);
}

.d-tab.active {
    color: #FF5A28;
    border-bottom-color: #FF5A28;
    font-weight: 600;
}

/* ── Forms ── */
.d-form-group {
    margin-bottom: 18px;
}

.d-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.d-input {
    width: 100%;
    padding: 11px 16px;
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.15s;
}

.d-input:focus {
    border-color: #FF5A28;
    box-shadow: 0 0 0 3px rgba(255, 90, 40, 0.1);
}

.d-input::placeholder {
    color: var(--text-muted);
}

.d-textarea {
    min-height: 80px;
    resize: vertical;
}

.d-select {
    appearance: none;
    width: 100%;
    padding: 11px 16px;
    padding-right: 40px;
    background: var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E") no-repeat right 16px center;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.15s;
}

.d-select:focus {
    border-color: #FF5A28;
}

.d-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.d-form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.d-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.d-checkbox input {
    accent-color: #FF5A28;
}

/* ── Modal ── */
.d-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.d-modal-overlay.show {
    display: flex;
}

.d-modal-content,
.d-modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.d-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
}

.d-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.d-modal-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
}

.d-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.d-modal-body {
    padding: 24px 28px;
}

.d-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 28px;
    border-top: 1px solid var(--border);
}

/* ── Toast ── */
.d-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.d-toast {
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.d-toast-success {
    background: var(--card-bg);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: #16A34A;
}

.d-toast-error {
    background: var(--card-bg);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #DC2626;
}

.d-toast-info {
    background: var(--card-bg);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #2563EB;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Grid Helpers ── */
.d-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.d-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.d-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

/* ── Activity ── */
.d-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

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

.d-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.d-activity-text {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.d-activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── Empty States ── */
.d-empty {
    text-align: center;
    padding: 56px 20px;
}

.d-empty-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.d-empty-img {
    width: 200px;
    height: auto;
    margin-bottom: 24px;
    opacity: 0.9;
    border-radius: 16px;
}

.d-empty h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.d-empty p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* ── Skeleton ── */
.d-skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--card-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Pagination ── */
.d-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-top: 8px;
}

.d-pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

.d-pagination-btns {
    display: flex;
    gap: 4px;
}

.d-pagination-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.d-pagination-btn:hover {
    background: var(--bg-tertiary);
}

.d-pagination-btn.active {
    background: #FF5A28;
    color: #fff;
    border-color: #FF5A28;
}

/* ── Progress ── */
.d-progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
}

.d-progress-bar {
    height: 100%;
    border-radius: 100px;
    transition: width 0.6s ease;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .d-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .d-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .d-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .d-sidebar.open {
        transform: translateX(0);
    }

    .d-main {
        margin-left: 0;
    }

    .d-mobile-toggle {
        display: block;
    }

    .d-stats-grid {
        grid-template-columns: 1fr;
    }

    .d-content {
        padding: 20px;
    }

    .d-grid-3 {
        grid-template-columns: 1fr;
    }

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