*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #282838;
    color: #e1e4e8;
    min-height: 100vh;
}

/* ── Header ── */

header {
    background: #191927;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-logo {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

.header-text h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.1rem;
}

.header-text p {
    color: #7a7f96;
    font-size: 0.8rem;
}

.header-btn {
    background: rgba(67,97,238,0.2);
    border: 1px solid rgba(67,97,238,0.4);
    color: #a5b4fc;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.header-btn:hover {
    background: rgba(67,97,238,0.35);
    color: #c7d2fe;
}

.header-btn.secondary {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    color: #7a7f96;
}

.header-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #e1e4e8;
    border-color: rgba(255,255,255,0.2);
}

/* ── Dashboard & sections ── */

.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.section-wrapper {
    margin-top: 2rem;
}

.section-wrapper:first-child {
    margin-top: 0;
}

.section-wrapper.sortable-ghost {
    opacity: 0.3;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6b7280;
    margin-bottom: 1rem;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: grab;
    user-select: none;
}

.section-title:active { cursor: grabbing; }

.section-title span {
    flex: 1;
}

.section-collapse-btn {
    background: none;
    border: none;
    color: #555c6e;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0 0.15rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.15s;
}

.section-collapse-btn:hover { color: #a5b4fc; }

.section-wrapper.collapsed .section-collapse-btn {
    transform: rotate(-90deg);
}

.section-wrapper.collapsed .grid {
    display: none;
}

.section-rename-btn,
.section-delete-btn {
    background: none;
    border: none;
    line-height: 1;
    padding: 0 0.2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.section-wrapper:hover .section-rename-btn,
.section-wrapper:hover .section-delete-btn {
    opacity: 1;
}

.section-rename-btn {
    color: #555c6e;
    font-size: 0.85rem;
}

.section-rename-btn:hover { color: #7a85c1; }

.section-delete-btn {
    color: #555c6e;
    font-size: 1rem;
}

.section-delete-btn:hover { color: #f87171; }

/* ── Grid & tiles ── */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    min-height: 60px;
}

.tile {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.tile:hover {
    transform: translateY(-2px);
    border-color: rgba(67,97,238,0.35);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.tile.sortable-ghost {
    opacity: 0.35;
    border-color: rgba(67,97,238,0.5);
}

.tile.sortable-drag {
    cursor: grabbing;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    border-color: rgba(67,97,238,0.6);
}

.tile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    cursor: grab;
    user-select: none;
}

.tile-header:active { cursor: grabbing; }

.tile-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.tile-icon.blue   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.tile-icon.purple { background: rgba(139,92,246,0.15); color: #a78bfa; }
.tile-icon.green  { background: rgba(16,185,129,0.15); color: #34d399; }
.tile-icon.orange { background: rgba(245,158,11,0.15); color: #fbbf24; }
.tile-icon.pink   { background: rgba(236,72,153,0.15); color: #f472b6; }
.tile-icon.cyan   { background: rgba(6,182,212,0.15); color: #22d3ee; }

.tile-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #f0f1f3;
}

.tile-section {
    margin-bottom: 1rem;
}

.tile-section:last-child { margin-bottom: 0; }

.tile-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555c6e;
    margin-bottom: 0.5rem;
}

.link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.link-row a {
    color: #93a3bf;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s;
}

.link-row a:hover { color: #4361ee; }

.env-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    min-width: 42px;
    text-align: center;
    flex-shrink: 0;
}

.env-badge.dev  { background: rgba(59,130,246,0.15); color: #60a5fa; }
.env-badge.tst  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.env-badge.acc  { background: rgba(139,92,246,0.15); color: #a78bfa; }
.env-badge.prod { background: rgba(16,185,129,0.15); color: #34d399; }
.env-badge.api  { background: rgba(236,72,153,0.15); color: #f472b6; }

/* ── Modal ── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1.75rem;
    width: 340px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f0f1f3;
    margin-bottom: 1rem;
}

.modal-input {
    width: 100%;
    background: #282838;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #e1e4e8;
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    outline: none;
    margin-bottom: 1.25rem;
    transition: border-color 0.15s;
}

.modal-input:focus {
    border-color: rgba(67,97,238,0.6);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-cancel {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: #7a7f96;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.modal-cancel:hover {
    background: rgba(255,255,255,0.05);
    color: #e1e4e8;
}

.modal-confirm {
    background: rgba(67,97,238,0.25);
    border: 1px solid rgba(67,97,238,0.5);
    color: #a5b4fc;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-confirm:hover {
    background: rgba(67,97,238,0.4);
}
