/* ============================================================================
   DEPLOYR — Portal do Cliente v5
   Design system idêntico ao admin Deployr
   Paleta: #00c78c (verde) + #0b8dcd (azul)
   Layout: Sidebar vertical dark (#0f1923) + conteúdo à direita
   ============================================================================ */

:root {
    /* Paleta Deployr */
    --green:          #00c78c;
    --green-dark:     #00a374;
    --green-glow:     rgba(0, 199, 140, 0.15);
    --green-dim:      rgba(0, 199, 140, 0.08);
    --blue:           #0b8dcd;
    --blue-dark:      #0874aa;
    --blue-glow:      rgba(11, 141, 205, 0.15);

    /* Superfícies */
    --bg:             #f4f6f8;
    --bg-elevated:    #ffffff;
    --surface:        #ffffff;
    --surface-2:      #f0f2f5;
    --surface-hover:  #eaf7f3;
    --surface-active: #ddf4ed;
    --overlay:        rgba(0, 0, 0, 0.35);

    /* Texto */
    --ink:            #0f1923;
    --ink-muted:      #4b5a6e;
    --ink-light:      #8694a8;
    --ink-disabled:   #b8c4d0;

    /* Bordas */
    --border:         #e4e8ed;
    --border-strong:  #cdd4dc;
    --border-brand:   rgba(0, 199, 140, 0.35);

    /* Semânticas */
    --success:        #00c78c;
    --success-bg:     rgba(0, 199, 140, 0.1);
    --warn:           #f59e0b;
    --warn-bg:        rgba(245, 158, 11, 0.1);
    --error:          #f43f5e;
    --error-bg:       rgba(244, 63, 94, 0.1);
    --info:           #0b8dcd;
    --info-bg:        rgba(11, 141, 205, 0.1);

    /* Sidebar */
    --sidebar-w:      240px;
    --sidebar-bg:     #0f1923;
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --sidebar-ink:    #c8d4ed;
    --sidebar-muted:  #5a6a84;
    --sidebar-hover:  rgba(255, 255, 255, 0.07);
    --sidebar-active-bg: var(--green);
    --sidebar-active-ink: #0d1a14;

    /* Forma */
    --radius-xs:  4px;
    --radius-sm:  8px;
    --radius:     10px;
    --radius-md:  12px;
    --radius-lg:  16px;

    /* Sombras */
    --shadow-sm:  0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow:     0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-md:  0 8px 32px rgba(0, 0, 0, 0.10);
    --shadow-lg:  0 16px 64px rgba(0, 0, 0, 0.14);
    --glow-green: 0 0 20px rgba(0, 199, 140, 0.25);
    --glow-blue:  0 0 20px rgba(11, 141, 205, 0.20);

    /* Transição */
    --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-family: "Space Grotesk", "Inter", sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

p { margin: 0; }

a {
    color: var(--green);
    text-decoration: none;
    transition: color var(--ease);
}
a:hover { color: var(--green-dark); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-disabled); }

/* ============================================================================
   AUTH PAGE
   ============================================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, rgba(0, 199, 140, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(11, 141, 205, 0.07) 0%, transparent 60%),
        var(--bg);
}

.auth-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--green) 0%, var(--blue) 100%);
    color: #fff;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 22px;
    display: grid;
    place-items: center;
    box-shadow: var(--glow-green);
    flex-shrink: 0;
}

.auth-tagline {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--green);
    font-weight: 600;
    margin-bottom: 2px;
}

.auth-title { font-size: 22px; color: var(--ink); }

.auth-subtitle {
    color: var(--ink-muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.auth-error {
    background: var(--error-bg);
    color: var(--error);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid rgba(244, 63, 94, 0.25);
    display: none;
}
.auth-error.show { display: block; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 6px;
}

.auth-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--ink);
    transition: border-color var(--ease), box-shadow var(--ease);
}
.auth-input::placeholder { color: var(--ink-light); }
.auth-input:hover { border-color: var(--border-brand); }
.auth-input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-dim);
}

.auth-input-wrap {
    position: relative;
}
.auth-input-wrap .auth-input {
    padding-left: 40px;
}
.auth-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ink-light);
    pointer-events: none;
}

.auth-submit {
    margin-top: 8px;
    padding: 13px 20px;
    background: var(--green);
    color: #0d1a14;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: "Space Grotesk", inherit;
    cursor: pointer;
    transition: background var(--ease), box-shadow var(--ease), transform 0.1s;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}
.auth-submit:hover {
    background: var(--green-dark);
    box-shadow: var(--glow-green);
}
.auth-submit:active { transform: scale(0.99); }

.auth-footer {
    margin-top: 24px;
    font-size: 12px;
    color: var(--ink-light);
    text-align: center;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

/* ── Shell principal (sidebar + conteúdo) ────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

/* ── Brand / logo ────────────────────────────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    text-decoration: none;
    flex-shrink: 0;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 8px;
}
.sidebar-brand:hover { opacity: 0.9; }

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    background: linear-gradient(135deg, var(--green) 0%, var(--blue) 100%);
    color: #fff;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 15px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 199, 140, 0.35);
}

.sidebar-brand-name {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #e8f0fc;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.sidebar-brand-name span { color: var(--green); }

/* ── Navegação ───────────────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 0 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Seção label */
.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
    padding: 14px 8px 6px;
    white-space: nowrap;
}

/* Item de nav */
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-ink);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: inherit;
    transition: background var(--ease), color var(--ease);
    text-decoration: none;
    white-space: nowrap;
    width: 100%;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.nav-item-active {
    background: var(--sidebar-active-bg) !important;
    color: var(--sidebar-active-ink) !important;
    font-weight: 600;
}
.nav-item svg { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }
.nav-item:hover svg { opacity: 0.9; }
.nav-item-active svg { opacity: 1; }

/* Separador */
.nav-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 8px 0;
}

/* ── Rodapé da sidebar (usuário + status) ────────────────────────────────── */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(0, 199, 140, 0.1);
    border: 1px solid rgba(0, 199, 140, 0.2);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    width: fit-content;
}

.sidebar-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* User dropdown na sidebar */
.sidebar-user-wrap {
    position: relative;
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: inherit;
    color: var(--sidebar-ink);
    transition: background var(--ease);
    width: 100%;
    text-align: left;
}
.sidebar-user-btn:hover { background: var(--sidebar-hover); }

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    background: linear-gradient(135deg, var(--green) 0%, var(--blue) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-family: "Space Grotesk", sans-serif;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #e8f0fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.sidebar-user-role {
    font-size: 11px;
    color: var(--sidebar-muted);
    line-height: 1.2;
}

.nav-chevron {
    transition: transform var(--ease);
    opacity: 0.5;
    flex-shrink: 0;
    width: 12px;
    height: 12px;
}
.sidebar-user-wrap.open .nav-chevron { transform: rotate(180deg); opacity: 1; }

/* Dropdown do usuário (abre para cima) */
.sidebar-user-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1a2336;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.25);
    padding: 6px;
    z-index: 300;
}
.sidebar-user-dropdown.open { display: block; }

.nav-dropdown-header { padding: 8px 12px 6px; }
.nav-dropdown-header-name { font-size: 13px; font-weight: 600; color: #e8f0fc; }
.nav-dropdown-header-sub { font-size: 11px; color: var(--sidebar-muted); margin-top: 1px; }

.nav-dropdown-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 4px 0; }

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: #b8c8e8;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
    white-space: nowrap;
    border: none;
    background: transparent;
    width: 100%;
    font-family: inherit;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-dropdown-item--danger { color: var(--error); }
.nav-dropdown-item--danger:hover { background: var(--error-bg); color: var(--error); }

/* ── Mobile overlay e toggle ─────────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 250;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--sidebar-border);
}
.mobile-menu-btn svg { width: 20px; height: 20px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
}
.sidebar-overlay.open { display: block; }

/* ============================================================================
   PAGE LAYOUT
   ============================================================================ */
.page-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.page-content {
    padding: 28px 32px;
    flex: 1;
}

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

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    font-family: "Space Grotesk", sans-serif;
}

.page-subtitle {
    font-size: 13px;
    color: var(--ink-muted);
    margin-top: 4px;
}

.page-header .breadcrumb {
    font-size: 12px;
    color: var(--ink-light);
    margin-bottom: 4px;
}
.page-header .breadcrumb a { color: var(--green); }

/* ============================================================================
   METRICS / STAT CARDS
   ============================================================================ */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--ease), box-shadow var(--ease);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--green-glow), transparent);
    opacity: 0;
    transition: opacity var(--ease);
}
.metric-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.metric-card:hover::before { opacity: 1; }

.metric-card .card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 18px;
    margin-bottom: 14px;
    background: var(--surface-2);
}
.metric-card .card-icon svg { width: 18px; height: 18px; }

.metric-card .label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.metric-card .value {
    font-size: 30px;
    font-weight: 700;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.metric-card .meta { font-size: 12px; color: var(--ink-light); margin-top: 8px; }

.metric-card.highlight {
    border-color: var(--border-brand);
    background: linear-gradient(145deg, var(--surface) 0%, rgba(0, 199, 140, 0.04) 100%);
}
.metric-card.highlight .value { color: var(--green); }

/* Icon colors */
.card-icon.green { background: var(--green-glow); color: var(--green); }
.card-icon.blue  { background: var(--blue-glow);  color: var(--blue); }
.card-icon.warn  { background: var(--warn-bg);    color: var(--warn); }
.card-icon.error { background: var(--error-bg);   color: var(--error); }
.card-icon.info  { background: var(--info-bg);    color: var(--info); }

/* ============================================================================
   CARDS
   ============================================================================ */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.card-header h3 svg { width: 16px; height: 16px; color: var(--ink-muted); }

.card-header .sub { font-size: 12px; color: var(--ink-muted); font-weight: 400; }

.card-header .card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-body { padding: 20px; }
.card-wide { grid-column: 1 / -1; }

/* ── Charts ──────────────────────────────────────────────────────────────── */
.chart-wrap { height: 240px; position: relative; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-wrap th,
.table-wrap td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table-wrap th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-muted);
    font-weight: 600;
    background: var(--surface-2);
    white-space: nowrap;
}

.table-wrap tbody tr { transition: background var(--ease); }
.table-wrap tbody tr:hover { background: var(--surface-hover); }
.table-wrap tbody tr:last-child td { border-bottom: none; }

.table-wrap .empty {
    color: var(--ink-light);
    text-align: center;
    padding: 32px;
    font-size: 13px;
}

.table-wrap .text-right { text-align: right; }
.table-wrap .text-center { text-align: center; }
.font-mono {
    font-family: "Space Grotesk", monospace;
    font-weight: 600;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge.active, .badge.completed, .badge.paid, .badge.healthy, .badge.sent {
    background: var(--success-bg); color: var(--success);
}
.badge.pending, .badge.open, .badge.queued, .badge.in_progress {
    background: var(--info-bg); color: var(--info);
}
.badge.running, .badge.warning, .badge.maintenance, .badge.waiting {
    background: var(--warn-bg); color: var(--warn);
}
.badge.failed, .badge.overdue, .badge.critical, .badge.error, .badge.cancelled, .badge.inactive {
    background: var(--error-bg); color: var(--error);
}
.badge.draft, .badge.closed, .badge.resolved {
    background: var(--surface-2); color: var(--ink-muted);
}

/* ── Alert banner ────────────────────────────────────────────────────────── */
.alert-banner {
    background: var(--warn-bg);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #d97706;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
    transition: all var(--ease);
    white-space: nowrap;
    line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--ink); }

.btn-primary {
    background: var(--green);
    color: #0d1a14;
    border-color: transparent;
    font-family: "Space Grotesk", inherit;
}
.btn-primary:hover { background: var(--green-dark); box-shadow: var(--glow-green); color: #0d1a14; }

.btn-secondary {
    background: var(--blue);
    color: #fff;
    border-color: transparent;
}
.btn-secondary:hover { background: var(--blue-dark); box-shadow: var(--glow-blue); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); border-color: transparent; }

.btn-sm { padding: 5px 11px; font-size: 12px; }

.btn-danger {
    background: var(--error-bg);
    color: var(--error);
    border-color: rgba(244, 63, 94, 0.25);
}
.btn-danger:hover { background: var(--error); color: #fff; }

.btn-icon {
    padding: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--ink-muted);
    display: inline-grid;
    place-items: center;
    transition: all var(--ease);
    width: 32px;
    height: 32px;
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: var(--surface-hover); color: var(--ink); border-color: var(--border-strong); }
.btn-icon.blue { color: var(--blue); }
.btn-icon.blue:hover { background: var(--blue-glow); border-color: var(--blue); }
.btn-icon.danger { color: var(--ink-light); }
.btn-icon.danger:hover { background: var(--error-bg); color: var(--error); border-color: rgba(244,63,94,0.25); }

.btn-ai {
    background: linear-gradient(135deg, var(--green) 0%, var(--blue) 100%);
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: var(--glow-green);
    transition: box-shadow var(--ease), transform 0.1s;
}
.btn-ai:hover {
    box-shadow: 0 0 32px rgba(0, 199, 140, 0.35);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Tag / Pill ──────────────────────────────────────────────────────────── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-muted);
}

/* ── Stat bar ────────────────────────────────────────────────────────────── */
.stat-bar {
    height: 4px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    margin-top: 10px;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--green) 0%, var(--blue) 100%);
    transition: width 0.6s ease;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--ink-light);
    gap: 8px;
}
.empty-state .empty-icon { font-size: 32px; opacity: 0.4; margin-bottom: 8px; }
.empty-state-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    color: var(--ink-light);
}
.empty-state-icon svg { width: 22px; height: 22px; }
.empty-state-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}
.empty-state-text { font-size: 13px; color: var(--ink-muted); }

/* ── Status dot ──────────────────────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--success-bg);
    border: 1px solid rgba(0, 199, 140, 0.2);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: var(--green);
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse-dot 2s infinite;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-input,
.form-select,
.form-textarea {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--ink);
    transition: border-color var(--ease), box-shadow var(--ease);
    width: 100%;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--ink-light); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-dim);
}
.form-textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11px; color: var(--ink-light); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}
.form-full { grid-column: 1 / -1; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 400;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-backdrop.open {
    display: flex;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-backdrop.open .modal {
    animation: modal-slide-in 0.25s ease;
}
@keyframes modal-slide-in {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-lg { max-width: 800px; }

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; color: var(--ink); margin: 0; }

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--ink-muted);
    border-radius: var(--radius-xs);
    display: grid;
    place-items: center;
    transition: background var(--ease), color var(--ease);
    font-size: 16px;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

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

.tab-btn {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    transition: all var(--ease);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
    color: var(--green);
    border-bottom-color: var(--green);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Info banners ────────────────────────────────────────────────────────── */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
}
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.info-banner.success {
    background: var(--success-bg);
    color: var(--green-dark);
    border: 1px solid var(--border-brand);
}
.info-banner.info {
    background: var(--info-bg);
    color: var(--blue-dark);
    border: 1px solid rgba(11, 141, 205, 0.25);
}
.info-banner.warn {
    background: var(--warn-bg);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.3s ease forwards;
    min-width: 280px;
    max-width: 420px;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success { background: var(--green); color: #0f1923; }
.toast.error   { background: var(--error); color: #fff; }
.toast.info    { background: var(--blue); color: #fff; }

@keyframes toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(20px); opacity: 0; }
}
.toast.removing { animation: toast-out 0.3s ease forwards; }

/* ── Spin animation ──────────────────────────────────────────────────────── */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Message bubbles (Tickets) ───────────────────────────────────────────── */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-bubble {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
}
.message-bubble.support {
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.message-bubble.client {
    background: var(--green-dim);
    border: 1px solid var(--border-brand);
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}
.message-meta .author { font-weight: 600; color: var(--ink); }
.message-meta .time   { color: var(--ink-light); }

/* ── Lists ───────────────────────────────────────────────────────────────── */
.stats-list, .task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.stats-list li, .task-list li {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background var(--ease);
}
.stats-list li:hover, .task-list li:hover { background: var(--surface-hover); }
.stats-list li:last-child, .task-list li:last-child { border-bottom: none; }

/* ── Order pipeline (stepper) ────────────────────────────────────────────── */
.order-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 20px 0 0 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
}
.order-pipeline-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-disabled);
    position: relative;
    white-space: nowrap;
}
.order-pipeline-step::after {
    content: '';
    width: 24px;
    height: 2px;
    background: var(--border);
    margin-left: 8px;
    flex-shrink: 0;
}
.order-pipeline-step:last-child::after { display: none; }
.order-pipeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.order-pipeline-step.done { color: var(--green); }
.order-pipeline-step.done .order-pipeline-dot {
    background: var(--green);
    box-shadow: 0 0 8px rgba(0, 199, 140, 0.4);
}
.order-pipeline-step.done::after { background: var(--green); }
.order-pipeline-step.current { color: var(--blue); }
.order-pipeline-step.current .order-pipeline-dot {
    background: var(--blue);
    box-shadow: 0 0 8px rgba(11, 141, 205, 0.4);
    width: 10px;
    height: 10px;
}
.order-pipeline-step.cancelled { color: var(--error); }
.order-pipeline-step.cancelled .order-pipeline-dot { background: var(--error); }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted    { color: var(--ink-muted); }
.text-light    { color: var(--ink-light); }
.text-green    { color: var(--green); }
.text-blue     { color: var(--blue); }
.text-error    { color: var(--error); }
.text-warn     { color: var(--warn); }

.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; }
.flex-end     { display: flex; justify-content: flex-end; }

.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.hidden { display: none !important; }

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.skeleton {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 0.3; }
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.w75 { width: 75%; }
.skeleton-line.w50 { width: 50%; }
.skeleton-line.w25 { width: 25%; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1280px) {
    .metrics-row { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .mobile-menu-btn { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.mobile-open { transform: translateX(0); }

    .page-wrapper { margin-left: 0; }
    .page-content { padding: 60px 16px 20px; }
}

@media (max-width: 768px) {
    .metrics-row { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .modal { max-width: 100%; }
}

@media (max-width: 480px) {
    .page-content { padding: 56px 12px 16px; }
    .card-body { padding: 16px; }
    .card-header { padding: 14px 16px; }
}
