:root {
    --primary: #244c5a;
    --primary-light: #3a6e7f;
    --primary-dark: #1a3640;
    --accent: #91b8c1;
    --accent-light: #b5d4db;
    --success: #2e7d32;
    --warning: #f57c00;
    --danger: #c62828;
    --bg: #f8fafb;
    --sidebar-bg: #244c5a;
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); /* Softer, broader shadow */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus: var(--primary);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: #333;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    z-index: 1000;
    transition: width 0.3s;
}

.sidebar .brand {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar .brand img {
    max-height: 36px;
    width: auto;
}

.sidebar .nav-section {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar .nav-section-title {
    padding: 8px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar a.active {
    border-left: 3px solid var(--accent);
}

/* ── Main content ── */
.main-content {
    margin-left: 250px;
    padding: 20px 30px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e8eef0;
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* ── Cards ── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

/* ── Tables ── */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table-card .card-header {
    padding: 15px 20px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-card table {
    margin-bottom: 0;
}

.table-card th {
    background: #fafafa;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

/* ── Pipeline / Kanban ── */
.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: 400px;
}

.kanban-column {
    min-width: 240px;
    max-width: 280px;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 8px;
    color: #fff;
}

.kanban-drop-zone {
    flex: 1;
    min-height: 60px;
    border-radius: 8px;
    transition: all 0.2s ease;
    padding: 2px;
}

.kanban-drop-zone.drag-over {
    background: rgba(0, 188, 212, 0.08);
    border: 2px dashed var(--accent);
    border-radius: 8px;
}

.kanban-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.15s, opacity 0.2s;
    user-select: none;
}

.kanban-card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    box-shadow: 0 0 0 2px var(--accent);
}

.kanban-card .card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.kanban-card .card-meta {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.kanban-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.kanban-card-link:hover {
    color: inherit;
}

.kanban-placeholder {
    text-align: center;
    color: #bbb;
    font-size: 0.8rem;
    padding: 20px 10px;
    display: none;
}

.kanban-drop-zone:empty+.kanban-placeholder,
.kanban-drop-zone .kanban-placeholder:only-child {
    display: block;
}

.kanban-drop-zone.drag-over .kanban-placeholder {
    display: block;
    color: var(--accent);
    font-weight: 600;
}

/* ── Badges ── */
.badge-stage {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Flash messages ── */
.flash-success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.flash-error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* ── One-click buttons ── */
.btn-oneclick {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-oneclick:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(36, 76, 90, 0.35);
    color: #fff;
}

.btn-oneclick.btn-success-grad {
    background: var(--success);
}

.btn-oneclick.btn-success-grad:hover {
    background: #388e3c;
}

.btn-oneclick.btn-warning-grad {
    background: var(--warning);
}

.btn-oneclick.btn-warning-grad:hover {
    background: #ef6c00;
}

.btn-oneclick.btn-secondary {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-oneclick.btn-secondary:hover {
    background: var(--accent-light);
}

/* ── Checklist ── */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.checklist-item.done {
    opacity: 0.6;
}

.checklist-item.done .checklist-label {
    text-decoration: line-through;
}

/* ── Timeline ── */
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-left: 2px solid #e0e0e0;
    margin-left: 10px;
    padding-left: 20px;
    position: relative;
}

.timeline-item::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    left: -6px;
    top: 14px;
}

.timeline-item .timeline-body {
    font-size: 0.9rem;
}

.timeline-item .timeline-meta {
    font-size: 0.75rem;
    color: #999;
}

/* ── Kanban Toast ── */
.kanban-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.kanban-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.kanban-toast-success {
    background: var(--primary);
}

.kanban-toast-danger {
    background: var(--danger);
}

/* ── Complete Task Button ── */
.btn-complete-task {
    color: #6c757d;
    background-color: transparent;
    border: 1px solid #ced4da;
    transition: all 0.2s ease-in-out;
}

.btn-complete-task:hover {
    color: #fff;
    background-color: var(--success);
    border-color: var(--success);
}

.btn-complete-task .check-filled {
    display: none;
}

.btn-complete-task .check-empty {
    display: inline-block;
}

.btn-complete-task:hover .check-empty {
    display: none;
}

.btn-complete-task:hover .check-filled {
    display: inline-block;
}

/* ── Modern Forms ── */
.form-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.03);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 4px;
}

.form-control-premium {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--input-bg);
    background-clip: padding-box;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-md);
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-control-premium:focus {
    color: var(--text-main);
    background-color: #fff;
    border-color: var(--input-focus);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-control-premium::placeholder {
    color: #cbd5e1;
    opacity: 1;
}

.form-control-premium:disabled, .form-control-premium[readonly] {
    background-color: #f1f5f9;
    opacity: 0.7;
    cursor: not-allowed;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.input-group-premium {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-check-premium {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.form-check-premium:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.form-check-premium input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 4px;
    cursor: pointer;
}

.form-preview-box {
    background: #f8fafc;
    border: 1px dashed var(--input-border);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-top: 10px;
}

/* ── Specific Overrides for Core ── */
.btn-premium {
    border-radius: var(--border-radius-md);
    padding: 10px 24px;
    font-weight: 600;
    transition: all 0.2s;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar a span {
        display: none;
    }

    .sidebar .brand span {
        display: none;
    }

    .main-content {
        margin-left: 60px;
    }
}