/*
 * DM Portal Theme — Facebook / Clean Light
 * Derived from "Domain Management System" frontend template
 *
 * @package domain_management
 */

/* =========================================================
   1. CSS Custom Properties — Facebook Light Palette
   ========================================================= */
:root {
    --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;

    /* Bootstrap override */
    --bs-body-font-family: var(--font-sans);

    /* Backgrounds */
    --background: #F0F2F5;
    --foreground: #050505;

    --card: #FFFFFF;
    --card-foreground: #050505;

    /* Primary — Facebook Blue */
    --primary: #1877F2;
    --primary-foreground: #FFFFFF;

    --secondary: #E4E6EB;
    --secondary-foreground: #050505;

    --muted: #E4E6EB;
    --muted-foreground: #65676B;

    --border: #CED0D4;
    --input: #E4E6EB;
    --ring: #1877F2;
    --radius: 8px;

    /* Sidebar */
    --sidebar-background: #FFFFFF;
    --sidebar-foreground: #050505;
    --sidebar-primary: #1877F2;
    --sidebar-accent: #F2F2F2;
    --sidebar-accent-foreground: #050505;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-teal: 0 0 0 2px rgba(24, 119, 242, 0.25);
    --shadow-glow: 0 0 0 2px rgba(24, 119, 242, 0.15);

    /* Semantic colours */
    --dm-success: #22c55e;
    --dm-success-subtle: rgba(34, 197, 94, .12);
    --dm-warning: #f59e0b;
    --dm-warning-subtle: rgba(245, 158, 11, .12);
    --dm-danger: #ef4444;
    --dm-danger-subtle: rgba(239, 68, 68, .12);

    /* Layout */
    --topbar-h: 60px;
    --sidebar-w: 240px;
    --sidebar-collapsed: 68px;

    /* Motion */
    --ease: cubic-bezier(.16, 1, .3, 1);
    --ease-std: cubic-bezier(.4, 0, .2, 1);
    --dur-sm: 180ms;
    --dur-md: 280ms;
    --dur-lg: 400ms;
}

/* =========================================================
   2. Keyframe Animations
   ========================================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dm-page-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dm-fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dm-slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes dm-ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes dm-toast-in {
    from {
        opacity: 0;
        transform: translateX(110%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes dm-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 80px;
        margin-bottom: .5rem;
    }

    to {
        opacity: 0;
        transform: translateX(110%);
        max-height: 0;
        margin-bottom: 0;
    }
}

@keyframes dm-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes dm-count-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   3. Base / Reset
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--foreground);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--dur-sm) var(--ease-std);
}

a:hover {
    color: var(--foreground);
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* =========================================================
   4. App Shell Layout — Top Bar + Sidebar + Content
   ========================================================= */

/* Body grid when user is logged in */
body.dm-app {
    display: grid;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar content";
    min-height: 100vh;
    overflow: hidden;
    transition: grid-template-columns var(--dur-md) var(--ease);
}

body.dm-app.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
}

/* ── Topbar ───────────────────────────────────────── */
.dm-topbar {
    grid-area: topbar;
    height: var(--topbar-h);
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 40;
}

.dm-topbar__left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.dm-topbar__right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.dm-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: .5rem;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: all var(--dur-sm) var(--ease-std);
}

.dm-sidebar-toggle:hover {
    background: var(--secondary);
    color: var(--foreground);
    border-color: var(--border);
}

.dm-topbar__bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: .5rem;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--muted-foreground);
    font-size: 1.1rem;
    transition: all var(--dur-sm) var(--ease-std);
    text-decoration: none;
}

.dm-topbar__bell:hover {
    background: var(--secondary);
    color: var(--foreground);
    border-color: var(--border);
}

.dm-topbar__bell-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dm-danger);
    border: 1.5px solid var(--sidebar-background);
}

.dm-topbar__user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .4rem .75rem;
    border-radius: .5rem;
    cursor: pointer;
    transition: background var(--dur-sm) var(--ease-std);
    text-decoration: none;
}

.dm-topbar__user:hover {
    background: var(--secondary);
}

.dm-topbar__user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.dm-topbar__user-name {
    font-size: .85rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.2;
}

.dm-topbar__user-role {
    font-size: .7rem;
    color: var(--muted-foreground);
    line-height: 1;
    text-transform: uppercase;
}

.dm-topbar__logout-label {
    font-size: .8rem;
}

.dm-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: .5rem;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--muted-foreground);
    transition: all var(--dur-sm) var(--ease-std);
}

.dm-mobile-menu-btn:hover {
    background: var(--secondary);
    color: var(--foreground);
}

/* ── Sidebar ──────────────────────────────────────── */
.dm-sidebar {
    grid-area: sidebar;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-background);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width var(--dur-md) var(--ease), min-width var(--dur-md) var(--ease);
    z-index: 200;
}

.sidebar-collapsed .dm-sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
}

.dm-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    height: var(--topbar-h);
    padding: 0 1.5rem;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.dm-sidebar__brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(24, 119, 242, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary);
    flex-shrink: 0;
}

.dm-sidebar__brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1C1E21 !important;
    /* prevent WP link color override */
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--dur-sm) var(--ease-std);
}

.sidebar-collapsed .dm-sidebar__brand-name {
    opacity: 0;
    width: 0;
}

.dm-nav-section-label {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted-foreground);
    padding: 1.25rem 1rem .5rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--dur-sm) var(--ease-std);
}

.sidebar-collapsed .dm-nav-section-label {
    opacity: 0;
}

.dm-nav {
    padding: .5rem .75rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dm-nav::-webkit-scrollbar {
    display: none;
}

.dm-nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .75rem;
    border-radius: .5rem;
    color: #1C1E21 !important;
    /* defeat WP default link color */
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none !important;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    transition: background var(--dur-sm) var(--ease-std),
        color var(--dur-sm) var(--ease-std);
    animation: dm-slide-in-left var(--dur-md) var(--ease) both;
}

.dm-nav-item:hover {
    background: var(--sidebar-accent);
    color: #1877F2 !important;
}

.dm-nav-item.active,
.dm-nav-item[aria-current="page"] {
    background: rgba(24, 119, 242, 0.10);
    color: #1877F2 !important;
    font-weight: 700;
    border-radius: var(--radius);
}

.dm-nav-item__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    transition: transform var(--dur-sm) var(--ease);
}

/* Notification badge pill on nav items */
.dm-nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    flex-shrink: 0;
    transition: transform var(--dur-sm) var(--ease);
}

.dm-nav-item.active .dm-nav-badge,
.dm-nav-item[aria-current="page"] .dm-nav-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.dm-nav-item:hover .dm-nav-item__icon,
.dm-nav-item.active .dm-nav-item__icon {
    transform: scale(1.1);
    color: #1877F2 !important;
    /* blue icon on hover/active, not white */
}

.dm-nav-item__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--dur-sm) var(--ease-std);
}

.sidebar-collapsed .dm-nav-item__label {
    opacity: 0;
    width: 0;
}

.dm-nav-item__count {
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 700;
    background: var(--dm-danger);
    color: #fff;
    flex-shrink: 0;
}

.sidebar-collapsed .dm-nav-item__count {
    opacity: 0;
}

/* Collapsed tooltip */
.sidebar-collapsed .dm-nav-item {
    justify-content: center;
}

.sidebar-collapsed .dm-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--secondary);
    color: var(--foreground);
    font-size: .78rem;
    font-weight: 600;
    padding: .4rem .75rem;
    border-radius: .5rem;
    border: 1px solid var(--border);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-sm) var(--ease-std);
    z-index: 500;
}

.sidebar-collapsed .dm-nav-item:hover::after {
    opacity: 1;
}

.dm-sidebar-footer {
    padding: .75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Staggered nav entry */
.dm-nav-item:nth-child(1) {
    animation-delay: 40ms;
}

.dm-nav-item:nth-child(2) {
    animation-delay: 80ms;
}

.dm-nav-item:nth-child(3) {
    animation-delay: 120ms;
}

.dm-nav-item:nth-child(4) {
    animation-delay: 160ms;
}

.dm-nav-item:nth-child(5) {
    animation-delay: 200ms;
}

.dm-nav-item:nth-child(6) {
    animation-delay: 240ms;
}

.dm-nav-item:nth-child(7) {
    animation-delay: 280ms;
}

.dm-nav-item:nth-child(8) {
    animation-delay: 320ms;
}

.dm-nav-item:nth-child(9) {
    animation-delay: 360ms;
}

.dm-nav-item:nth-child(10) {
    animation-delay: 400ms;
}

/* ── Avatar ──────────────────────────────────────── */
.dm-avatar {
    border-radius: 50%;
    background: var(--secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
}

.dm-avatar--md {
    width: 32px;
    height: 32px;
    font-size: .875rem;
}

.dm-avatar--lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.dm-avatar--xl {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

/* ── Content Wrap ─────────────────────────────────── */
.dm-content-wrap {
    grid-area: content;
    overflow-y: auto;
    height: calc(100vh - var(--topbar-h));
    display: flex;
    flex-direction: column;
    background: var(--background);
}

.dm-content-wrap::-webkit-scrollbar {
    width: 6px;
}

.dm-content-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.dm-content-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.dm-content-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

.dm-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: dm-page-in var(--dur-lg) var(--ease) both;
}

/* Page header */
.dm-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.dm-page-title {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -.025em;
    margin: 0 0 .25rem;
    color: var(--foreground);
}

.dm-page-subtitle {
    font-size: .875rem;
    color: var(--muted-foreground);
    margin: 0;
}

/* ── SPA Navigation Progress & Transitions ───────── */
#dm-nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--dm-accent-1);
    width: 0%;
    z-index: 9999;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
}

#dm-nav-progress.active {
    opacity: 1;
}

#main.dm-fade-out {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

/* ── App Footer ───────────────────────────────────── */
.dm-app-footer {
    background: var(--sidebar-background);
    border-top: 1px solid var(--border);
    padding: .85rem 2rem;
}

.dm-app-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================================
   5. Components
   ========================================================= */

/* ── Cards ─────────────────────────────────────────── */
.card-dark {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: box-shadow .2s;
}

.card-dark:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Staggered animation */
.card-dark:nth-child(1) {
    animation: dm-fade-up var(--dur-lg) var(--ease) 0ms both;
}

.card-dark:nth-child(2) {
    animation: dm-fade-up var(--dur-lg) var(--ease) 60ms both;
}

.card-dark:nth-child(3) {
    animation: dm-fade-up var(--dur-lg) var(--ease) 120ms both;
}

.card-dark:nth-child(4) {
    animation: dm-fade-up var(--dur-lg) var(--ease) 180ms both;
}

/* Legacy dm-card class — maps to card-dark */
.dm-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.dm-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dm-card__title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

/* ── Stat Cards ─────────────────────────────────────── */
.dm-stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.dm-stat-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.dm-stat-card__icon {
    width: 42px;
    height: 42px;
    border-radius: .5rem;
    background: rgba(24, 119, 242, 0.10);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.dm-stat-card__label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .25rem;
}

.dm-stat-card__value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--foreground);
    letter-spacing: -.02em;
    line-height: 1.1;
}

/* ── Miscellaneous card elements ─────────────────── */
.micro-label {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted-foreground);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.1;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: .5rem;
    background: rgba(24, 119, 242, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    color: var(--primary);
}

.icon-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--muted-foreground);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    transition: color var(--dur-sm) var(--ease-std);
}

.icon-btn:hover {
    color: var(--foreground);
}

/* ── Badges ──────────────────────────────────────── */
.badge-green {
    border: 1px solid #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, .1);
}

.badge-yellow {
    border: 1px solid #eab308;
    color: #eab308;
    background: rgba(234, 179, 8, .1);
}

.badge-red {
    border: 1px solid #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, .1);
}

.badge-emerald {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: hsla(152, 60%, 42%, 0.15);
}

.badge-green,
.badge-yellow,
.badge-red,
.badge-emerald {
    border-radius: 999px;
    padding: 2px 10px;
    font-size: .7rem;
    font-weight: 500;
    display: inline-block;
}

/* dm-badge system aliases */
.dm-badge {
    border-radius: 999px;
    padding: 2px 10px;
    font-size: .7rem;
    font-weight: 600;
    display: inline-block;
}

.dm-badge--success {
    border: 1px solid #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, .1);
}

.dm-badge--danger {
    border: 1px solid #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, .1);
}

.dm-badge--warning {
    border: 1px solid #eab308;
    color: #eab308;
    background: rgba(234, 179, 8, .1);
}

.dm-badge--accent {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: rgba(0, 205, 230, .08);
}

.dm-badge--muted {
    border: 1px solid var(--border);
    color: var(--muted-foreground);
    background: transparent;
}

/* ── Tables ──────────────────────────────────────── */
.dark-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--foreground);
}

.dark-table th {
    color: var(--muted-foreground);
    font-size: .8rem;
    font-weight: 500;
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.dark-table td {
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    vertical-align: middle;
}

.dark-table tr:hover td {
    background: #F2F2F2;
}

/* ── Buttons ──────────────────────────────────────── */
.dm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.25rem;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: .875rem;
    font-weight: 600;
    line-height: 1;
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    user-select: none;
    transition: background var(--dur-sm) var(--ease-std), border-color var(--dur-sm), box-shadow var(--dur-sm), color var(--dur-sm), transform var(--dur-sm);
}

.dm-btn:active {
    transform: scale(.97);
}

.dm-btn--primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.dm-btn--primary:hover {
    background: #166FE5;
    border-color: #166FE5;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.35);
}

.dm-btn--secondary {
    background: var(--secondary);
    color: var(--foreground);
    border-color: var(--border);
}

.dm-btn--secondary:hover {
    background: #D8DADF;
    color: var(--foreground);
}

.dm-btn--ghost {
    background: transparent;
    color: var(--muted-foreground);
    border-color: transparent;
}

.dm-btn--ghost:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.dm-btn--danger {
    background: var(--dm-danger-subtle);
    color: var(--dm-danger);
    border-color: rgba(239, 68, 68, .3);
}

.dm-btn--danger:hover {
    background: var(--dm-danger);
    color: #fff;
}

.dm-btn--warning {
    background: var(--dm-warning-subtle);
    color: var(--dm-warning);
    border-color: rgba(245, 158, 11, .3);
}

.dm-btn--warning:hover {
    background: var(--dm-warning);
    color: #fff;
}

.dm-btn--success {
    background: var(--dm-success-subtle);
    color: var(--dm-success);
    border-color: rgba(34, 197, 94, .3);
}

.dm-btn--success:hover {
    background: var(--dm-success);
    color: #fff;
}

.dm-btn--sm {
    padding: .4rem .85rem;
    font-size: .8rem;
}

.dm-btn--lg {
    padding: .85rem 2rem;
    font-size: 1rem;
}

.dm-btn--block {
    width: 100%;
}

/* Ripple */
.dm-ripple-el {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .3);
    transform: scale(0);
    animation: dm-ripple 600ms linear;
    pointer-events: none;
}

/* ── Forms / Inputs ──────────────────────────────── */
.dm-input,
.dm-select,
.dm-textarea {
    width: 100%;
    padding: .5rem .75rem;
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: .5rem;
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: .875rem;
    outline: none;
    transition: border-color var(--dur-sm) var(--ease-std), box-shadow var(--dur-sm);
}

.dm-input:focus,
.dm-select:focus,
.dm-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}

/* Generic dark input (inline style override helper) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    background: var(--input);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: .5rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}

/* ── Drop Zone ──────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: border-color .2s, background .2s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.over {
    border-color: var(--primary);
    background: rgba(24, 119, 242, 0.04);
}

/* ── Tabs ────────────────────────────────────────── */
.tab-pills {
    display: flex;
    gap: .375rem;
    background: var(--secondary);
    border-radius: .6rem;
    padding: 4px;
}

.tab-pill {
    padding: .375rem 1rem;
    border-radius: .45rem;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    color: var(--muted-foreground);
    user-select: none;
}

.tab-pill.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

/* ── Progress / Vote Bars ─────────────────────────── */
.vote-bar-track {
    height: 6px;
    background: var(--muted);
    border-radius: 3px;
    flex: 1;
}

.vote-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

.dm-progress-bar-wrap {
    height: 6px;
    background: var(--muted);
    border-radius: 3px;
    overflow: hidden;
}

.dm-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--cyan-accent));
    border-radius: 3px;
    transition: width 1s var(--ease);
}

.dm-progress-ring__bg {
    fill: none;
    stroke: var(--secondary);
}

.dm-progress-ring__fill {
    fill: none;
    stroke: var(--primary);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1s var(--ease);
}

/* ── Alerts ──────────────────────────────────────── */
.dm-alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    border-radius: var(--radius);
    border: 1px solid;
    background: transparent;
    margin-bottom: 1rem;
}

.dm-alert--warning {
    border-color: rgba(245, 158, 11, .3);
    background: var(--dm-warning-subtle);
}

.dm-alert--success {
    border-color: rgba(34, 197, 94, .3);
    background: var(--dm-success-subtle);
}

.dm-alert--danger {
    border-color: rgba(239, 68, 68, .3);
    background: var(--dm-danger-subtle);
}

.dm-alert__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.dm-alert__title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: .2rem;
}

.dm-alert__body {
    font-size: .8rem;
    color: var(--muted-foreground);
}

/* Urgent card — left red border */
.urgent-card {
    border-left: 3px solid #f87171 !important;
}

/* ── Countdown chips ────────────────────────────── */
.dm-countdown {
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

.dm-countdown--urgent {
    background: rgba(239, 68, 68, .15);
    color: var(--dm-danger);
    border: 1px solid rgba(239, 68, 68, .3);
}

.dm-countdown--warn {
    background: rgba(245, 158, 11, .12);
    color: var(--dm-warning);
    border: 1px solid rgba(245, 158, 11, .3);
}

.dm-countdown--ok {
    background: rgba(34, 197, 94, .1);
    color: var(--dm-success);
    border: 1px solid rgba(34, 197, 94, .25);
}

/* ── Grid helpers ────────────────────────────────── */
.dm-grid {
    display: grid;
}

.dm-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.dm-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dm-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.dm-gap-1 {
    gap: .75rem;
}

.dm-gap-2 {
    gap: 1rem;
}

.dm-gap-3 {
    gap: 1.5rem;
}

.dm-gap-4 {
    gap: 2rem;
}

/* ── Text utilities ──────────────────────────────── */
.dm-text-success {
    color: var(--dm-success) !important;
}

.dm-text-danger {
    color: var(--dm-danger) !important;
}

.dm-text-warning {
    color: var(--dm-warning) !important;
}

.dm-text-muted {
    color: var(--muted-foreground) !important;
}

/* ── Toast Notifications ─────────────────────────── */
#dm-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 9999;
    pointer-events: none;
}

.dm-toast {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    min-width: 280px;
    max-width: 380px;
    padding: .875rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .4);
    animation: dm-toast-in .3s var(--ease) both;
    cursor: pointer;
    pointer-events: all;
    position: relative;
    overflow: hidden;
}

.dm-toast.hiding {
    animation: dm-toast-out .3s var(--ease-std) both;
}

.dm-toast__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dm-toast__title {
    font-size: .825rem;
    font-weight: 700;
    color: var(--foreground);
}

.dm-toast__body {
    font-size: .8rem;
    color: var(--muted-foreground);
}

.dm-toast__bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 999px;
}

.dm-toast--success .dm-toast__bar {
    background: var(--dm-success);
}

.dm-toast--danger .dm-toast__bar {
    background: var(--dm-danger);
}

.dm-toast--warning .dm-toast__bar {
    background: var(--dm-warning);
}

/* ── Modal ───────────────────────────────────────── */
.dm-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dm-modal-backdrop.is-open {
    display: flex;
}

.dm-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 560px;
    animation: dm-page-in var(--dur-md) var(--ease) both;
}

.dm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dm-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

.dm-modal__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    font-size: 1.25rem;
    padding: .25rem;
}

.dm-modal__close:hover {
    color: var(--foreground);
}

/* ── Discussion Thread (Proposed Domain) ──────────── */
.dm-discussion {
    border-top: 1px solid var(--border);
    padding-top: 1.75rem;
    margin-top: 1rem;
}

.dm-comments {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: .25rem;
}

.dm-comments::-webkit-scrollbar {
    width: 4px;
}

.dm-comments::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.dm-comment-item {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
}

.dm-comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--secondary);
    color: var(--primary);
    font-size: .85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dm-comment-body {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 0 .75rem .75rem .75rem;
    padding: .65rem .9rem;
    flex: 1;
}

.dm-comment-meta {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .3rem;
}

.dm-comment-meta strong {
    font-size: .8rem;
    font-weight: 700;
    color: var(--foreground);
}

.dm-comment-meta span {
    font-size: .72rem;
    color: var(--muted-foreground);
}

.dm-comment-text {
    font-size: .875rem;
    color: var(--muted-foreground);
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
}

.dm-comment-form-wrap {
    display: flex;
    gap: .85rem;
    align-items: flex-end;
    margin-top: .75rem;
}

.dm-comment-form {
    flex: 1;
}

.dm-comment-input-row {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
}

.dm-comment-textarea {
    flex: 1;
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: .6rem;
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: .875rem;
    padding: .85rem 1rem;
    resize: none;
    transition: border-color .2s, box-shadow .2s;
    max-height: 120px;
    line-height: 1.4;
}

.dm-comment-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 205, 230, .2);
}

/* ── Active Proposal card ─────────────────────────── */
.dm-active-proposal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

/* ── Proposals List Accordion ──────────── */
.dm-proposal-row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all var(--dur-md) var(--ease);
}

.dm-proposal-row:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.dm-proposal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    background: transparent;
    transition: background var(--dur-sm) var(--ease);
}

.dm-proposal-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.dm-proposal-header.active {
    background: rgba(16, 185, 129, 0.05);
    border-bottom: 1px solid var(--border);
}

.dm-proposal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 .25rem 0;
}

.dm-proposal-meta {
    font-size: .85rem;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dm-proposal-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.dm-proposal-stat {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 600;
}

.dm-proposal-chevron {
    color: var(--muted-foreground);
    transition: transform var(--dur-md) var(--ease);
}

.dm-proposal-header.active .dm-proposal-chevron {
    transform: rotate(180deg);
}

.dm-proposal-body {
    display: none;
    padding: 1.5rem;
    background: var(--card);
}

.dm-proposal-header.active+.dm-proposal-body {
    display: block;
    animation: dm-fade-in var(--dur-short) var(--ease) forwards;
}

.dm-proposal-body-inner {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
}

@media (max-width: 991px) {
    .dm-proposal-body-inner {
        grid-template-columns: 1fr;
    }
}

.dm-vote-btn {
    padding: .85rem 1rem !important;
    font-size: .95rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.dm-proposal-domain {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--foreground);
    margin: 0 0 .5rem;
    word-break: break-all;
}

.dm-proposal-cost {
    font-size: .875rem;
    color: var(--muted-foreground);
    margin-bottom: .75rem;
}

.dm-proposal-cost span {
    color: var(--dm-warning);
    font-weight: 700;
}

.dm-proposal-rationale {
    color: var(--muted-foreground);
    font-size: .9rem;
    line-height: 1.65;
    margin: 0 0 1rem;
}

.dm-proposal-meta {
    font-size: .78rem;
    color: var(--muted-foreground);
}

.dm-active-proposal__badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(0, 205, 230, .12);
    border: 1px solid rgba(0, 205, 230, .25);
    color: var(--primary);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: .3rem .85rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

/* ── Account Profile ──────────────────────────────── */
.dm-account-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
}

.dm-account-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 1.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 3px solid rgba(0, 205, 230, .3);
}

.dm-account-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--foreground);
    margin: 0 0 .25rem;
}

.dm-account-email {
    font-size: .85rem;
    color: var(--muted-foreground);
    margin: 0 0 .75rem;
}

.dm-account-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* ── Login page ───────────────────────────────────── */
.dm-public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    padding: 1rem;
}

/* ── Scrollbar (global) ─────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* ── Bootstrap overrides (keep dark theme) ─────── */
.text-primary {
    color: var(--primary) !important;
}

.bg-card {
    background-color: var(--card) !important;
}

.bg-background {
    background-color: var(--background) !important;
}

.border-border {
    border-color: var(--border) !important;
}

.text-foreground {
    color: var(--foreground) !important;
}

.text-muted-foreground {
    color: var(--muted-foreground) !important;
}

.fs-7 {
    font-size: .875rem;
}

/* =========================================================
   6. Responsive
   ========================================================= */
@media (max-width: 1024px) {
    .dm-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body.dm-app {
        grid-template-columns: 1fr;
        grid-template-areas: "topbar" "content";
    }

    .dm-mobile-menu-btn {
        display: flex !important;
    }

    .dm-sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        height: calc(100vh - var(--topbar-h));
        transform: translateX(-100%);
        transition: transform var(--dur-md) var(--ease);
        z-index: 400;
        box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
    }

    .dm-sidebar.open {
        transform: translateX(0);
    }

    .dm-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .55);
        backdrop-filter: blur(2px);
        z-index: 399;
    }

    .dm-sidebar.open~.dm-sidebar-overlay {
        display: block;
    }

    .dm-topbar__brand {
        width: auto;
        min-width: auto;
        border-right: none;
    }

    .dm-content-wrap {
        height: calc(100vh - var(--topbar-h));
    }

    .dm-content {
        padding: 1rem;
    }

    .dm-grid-2,
    .dm-grid-3,
    .dm-grid-4 {
        grid-template-columns: 1fr;
    }

    .dm-proposal-body {
        grid-template-columns: 1fr;
    }

    .dm-account-profile {
        flex-direction: column;
        text-align: center;
    }

    .dm-account-badges {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .dm-topbar__user-info {
        display: none;
    }

    .dm-topbar {
        padding: 0 1rem 0 0;
    }
}