/* ==========================================================================
 * DevPanel — extensions on top of the Adminix design system (style.css)
 * A compact, theme-aware utility layer + DevPanel-specific components.
 * All colors derive from the semantic tokens so light/dark work everywhere.
 * ========================================================================= */

/* ===== Layout ===== */
.container-page { max-width: 1200px; margin: 0 auto; }
.grid { display: grid; }
.g-cols-2 { grid-template-columns: repeat(2, 1fr); }
.g-cols-3 { grid-template-columns: repeat(3, 1fr); }
.g-cols-4 { grid-template-columns: repeat(4, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g-3-1 { grid-template-columns: 2fr 1fr; }
.col-span-2 { grid-column: span 2; }
.col-span-full { grid-column: 1 / -1; }
@media (max-width: 1023px) {
    .g-cols-3, .g-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .g-3-1 { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: auto; }
}
@media (max-width: 640px) {
    .g-cols-2, .g-cols-3, .g-cols-4 { grid-template-columns: 1fr; }
}

/* ===== Flex ===== */
.inline-flex { display: inline-flex; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

/* ===== Spacing ===== */
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; } .mt-6 { margin-top: 1.5rem; }
.mt-auto { margin-top: auto; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.25rem; } .mb-6 { margin-bottom: 1.5rem; }
.p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.card-head { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.card-body { padding: 1.5rem; }

/* ===== Sizing ===== */
.w-full { width: 100%; }
.h-full { height: 100%; }
.max-w-sm { max-width: 24rem; } .max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; } .max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; } .max-w-3xl { max-width: 48rem; }

/* ===== Text ===== */
.text-xs { font-size: 11px; } .text-sm { font-size: 13px; } .text-base { font-size: 14px; }
.text-lg { font-size: 16px; } .text-xl { font-size: 18px; } .text-2xl { font-size: 22px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; } .font-extrabold { font-weight: 800; }
.text-center { text-align: center; }
.text-strong { color: var(--text); }
.text-primary { color: var(--primary-dark); }
.text-accent { color: var(--accent-dark); }
.text-danger { color: var(--danger-dark); }
.text-success { color: var(--success-dark); }
.font-mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.whitespace-pre { white-space: pre-wrap; }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }
.leading-tight { line-height: 1.2; }
.underline { text-decoration: underline; }
.link { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ===== Surfaces / borders / radius ===== */
.bg-surface { background: var(--surface); }
.bg-surface-2 { background: var(--surface-2); }
.bg-soft { background: var(--soft); }
.rounded { border-radius: 0.5rem; }
.rounded-lg { border-radius: 0.625rem; }
.rounded-xl { border-radius: var(--radius); }
.rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.divide-y > * + * { border-top: 1px solid var(--border); }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.shadow-sm { box-shadow: var(--shadow-sm); }

/* ===== Stat card ===== */
.stat-icon {
    width: 44px; height: 44px; border-radius: 0.75rem;
    display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.stat-icon.c-primary { background: var(--primary); }
.stat-icon.c-accent  { background: var(--accent); }
.stat-icon.c-success { background: var(--success); }
.stat-icon.c-danger  { background: var(--danger); }
.stat-icon.c-info    { background: var(--primary); }
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin: 0; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); margin: 0.25rem 0 0; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--muted); margin: 0.5rem 0 0; }

/* ===== Alert ===== */
.alert { border-radius: 0.625rem; padding: 0.875rem 1rem; font-size: 13px; border: 1px solid; display: flex; gap: 0.625rem; }
.alert-title { font-weight: 700; }
.alert-info    { background: rgba(79,167,232,0.10); border-color: rgba(79,167,232,0.25); color: var(--primary-dark); }
.alert-success { background: rgba(123,198,126,0.12); border-color: rgba(123,198,126,0.3); color: var(--success-dark); }
.alert-warning { background: rgba(249,178,51,0.12); border-color: rgba(249,178,51,0.3); color: var(--accent-dark); }
.alert-danger  { background: rgba(229,115,115,0.12); border-color: rgba(229,115,115,0.28); color: var(--danger-dark); }
:root[data-theme="dark"] .alert-info { color: var(--primary-light); }

/* ===== Credential field ===== */
.cred-row { display: flex; gap: 0.5rem; align-items: center; }
.cred-row .input { font-family: ui-monospace, Menlo, Consolas, monospace; }
.cred-btn {
    flex-shrink: 0; width: 2.5rem; height: 2.5rem; border: 1px solid var(--border);
    background: var(--surface); border-radius: 0.5rem; cursor: pointer; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
}
.cred-btn:hover { background: var(--soft); color: var(--primary-dark); }

/* ===== Step tracker ===== */
.steps { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; }
.step-row { display: flex; align-items: center; width: 100%; }
.step-bar { height: 3px; flex: 1; background: var(--border); }
.step-bar.on { background: var(--primary); }
.step-dot {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
    background: var(--border); color: var(--muted);
}
.step-dot.on { background: var(--primary); color: #fff; }
.step-label { margin-top: 0.5rem; font-size: 11px; text-align: center; color: var(--muted); }
.step-label.on { color: var(--primary-dark); font-weight: 700; }

/* ===== Timeline ===== */
.timeline-item { position: relative; padding-left: 1.25rem; padding-bottom: 1.25rem; border-left: 2px solid var(--soft); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }

/* ===== Reminder card ===== */
.reminder-card { border-left: 4px solid var(--border); }
.reminder-card.u-red { border-left-color: var(--danger); }
.reminder-card.u-amber { border-left-color: var(--accent); }
.reminder-card.u-gray { border-left-color: var(--muted-light); }
.reminder-icon { font-size: 1.5rem; line-height: 1; }

/* ===== Service picker (order create) ===== */
.svc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
@media (max-width: 640px) { .svc-grid { grid-template-columns: repeat(2, 1fr); } }
.svc-tile {
    border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface);
    padding: 1rem; text-align: center; cursor: pointer; transition: all 150ms ease; display: block;
}
.svc-tile:hover { border-color: var(--primary-light); }
.svc-radio:checked + .svc-tile { border-color: var(--primary); background: var(--soft); }
.svc-radio { position: absolute; opacity: 0; width: 0; height: 0; }

/* ===== Web terminal ===== */
.terminal { border-radius: var(--radius); overflow: hidden; border: 1px solid #0b1220; background: #0d1526; box-shadow: var(--shadow-md); }
.terminal-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.875rem; background: #111c30; border-bottom: 1px solid #0b1220; }
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-out { height: 20rem; overflow-y: auto; padding: 0.75rem 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #e6edf5; }
.terminal-out::-webkit-scrollbar { width: 6px; }
.terminal-out::-webkit-scrollbar-thumb { background: #2a3a4f; border-radius: 4px; }
.terminal-line { white-space: pre-wrap; }
.terminal-line.cmd { color: #7bc67e; }
.terminal-line.err { color: #e57373; }
.terminal-input { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-top: 1px solid #0b1220; background: #0d1526; }
.terminal-input input { flex: 1; background: transparent; border: 0; outline: 0; color: #e6edf5; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* ===== Bar chart (reports) ===== */
.bars { display: flex; align-items: flex-end; gap: 0.5rem; height: 16rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.bar-fill { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; transition: all 200ms ease; min-height: 2px; }
.bar-fill:hover { background: var(--accent-dark); }
.bar-label { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ===== Misc helpers ===== */
.pill-brand { background: rgba(249,178,51,0.15); color: var(--accent-dark); border: 1px solid rgba(249,178,51,0.3); padding: 0.15rem 0.55rem; border-radius: 0.4rem; font-size: 11px; font-weight: 800; }
.empty-state { border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); padding: 2.5rem; text-align: center; color: var(--muted); }
[x-cloak] { display: none !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--success); }
.dot-gray { background: var(--muted-light); }

/* Fix: lucide replaces <i data-lucide> with <svg>, so adminix's `.input-icon > i`
   positioning no longer matches. Target svg (and a trailing wrapper) too. */
.input-icon > i,
.input-icon > svg,
.input-icon > .input-trailing {
    position: absolute;
    top: 50%;
    left: 0.875rem;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-light);
}
.input-icon > i,
.input-icon > svg { pointer-events: none; }
.input-icon > .input-trailing {
    left: auto;
    right: 0.875rem;
    width: auto;
    height: auto;
    pointer-events: auto;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.input-icon > .input-trailing:hover { color: var(--primary-dark); }
.input-icon .input { padding-left: 2.5rem; }
.input-icon .has-trailing { padding-right: 2.75rem; }

/* extra helpers */
.w-auto { width: auto; }
.input-inline { width: auto; min-width: 150px; height: 2.5rem; }
.relative { position: relative; }
.gap-2 { gap: 0.5rem; }
.table-actions { display: flex; justify-content: flex-end; gap: 0.75rem; font-size: 13px; }
.table-actions a, .table-actions button { color: var(--muted); background: none; border: none; cursor: pointer; font: inherit; text-decoration: none; }
.table-actions a:hover, .table-actions button:hover { color: var(--primary-dark); text-decoration: underline; }
.table-actions .danger:hover { color: var(--danger-dark); }
tr.row-warn { background: rgba(249,178,51,0.08); }
tr.row-danger { background: rgba(229,115,115,0.08); }
dl.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; font-size: 13px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; color: var(--text); font-weight: 600; }
.list-rows > * + * { border-top: 1px solid var(--border); }
.info-box { background: var(--surface-2); border-radius: 0.5rem; padding: 0.75rem; font-size: 12px; color: var(--muted); }
