/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background: #f0f2f5;
    color: #1f2328;
}

a { color: #3b82d4; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    background: #1e293b;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #334155;
}

.sidebar-brand h1 {
    font-size: 17px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.3px;
}

.sidebar-brand p {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #475569;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 24px;
    color: #94a3b8;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover { background: #334155; color: #f1f5f9; text-decoration: none; }
.sidebar-nav a.active { background: #3b82d4; color: #fff; }

.sidebar-nav a .icon {
    width: 18px;
    text-align: center;
    font-style: normal;
    flex-shrink: 0;
}

/* ── Main Content ── */
.main {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h2 { font-size: 18px; font-weight: 600; color: #1f2328; }
.topbar .breadcrumb { font-size: 13px; color: #57606a; margin-top: 2px; }

.content { padding: 28px; flex: 1; }

/* ── Cards ── */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2328;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}

/* ── Stat Grid ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 20px;
}

.stat-card .label { font-size: 12px; color: #57606a; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 32px; font-weight: 700; color: #1f2328; line-height: 1.2; margin: 4px 0 2px; }
.stat-card .sub { font-size: 12px; color: #57606a; }

.stat-card.blue { border-left: 4px solid #3b82d4; }
.stat-card.green { border-left: 4px solid #22c55e; }
.stat-card.orange { border-left: 4px solid #f59e0b; }
.stat-card.red { border-left: 4px solid #ef4444; }
.stat-card.purple { border-left: 4px solid #7c5cd8; }

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

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    background: #f7f8fa;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #57606a;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
tbody tr { border-bottom: 1px solid #f0f2f5; transition: background 0.1s; }
tbody tr:hover { background: #f7f8fa; }
tbody td { padding: 11px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ── Badges ── */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: capitalize;
    letter-spacing: 0.2px;
}

.badge-planning   { background: #e0e7ff; color: #4338ca; }
.badge-active     { background: #dcfce7; color: #166534; }
.badge-on_hold    { background: #fef9c3; color: #854d0e; }
.badge-completed  { background: #d1fae5; color: #065f46; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }

.badge-todo       { background: #f1f5f9; color: #475569; }
.badge-in_progress{ background: #dbeafe; color: #1d4ed8; }
.badge-review     { background: #fef3c7; color: #92400e; }
.badge-done       { background: #dcfce7; color: #166534; }

.badge-low        { background: #f0fdf4; color: #15803d; }
.badge-medium     { background: #fefce8; color: #a16207; }
.badge-high       { background: #fff7ed; color: #c2410c; }
.badge-critical   { background: #fef2f2; color: #b91c1c; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    line-height: 1;
}

.btn:hover { text-decoration: none; }

.btn-primary   { background: #3b82d4; color: #fff; border-color: #3b82d4; }
.btn-primary:hover { background: #2563b8; border-color: #2563b8; color: #fff; }

.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; color: #374151; }

.btn-danger    { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.btn-success   { background: #22c55e; color: #fff; border-color: #22c55e; }
.btn-success:hover { background: #16a34a; border-color: #16a34a; color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span2 { grid-column: span 2; }

label { font-size: 13px; font-weight: 500; color: #374151; }

input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2328;
    background: #fff;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82d4;
    box-shadow: 0 0 0 3px rgba(59,130,212,0.12);
}

textarea { resize: vertical; min-height: 80px; }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f2f5;
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success { background: #f0fdf4; color: #166534; border-color: #22c55e; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #ef4444; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #3b82d4; }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h3 { font-size: 16px; font-weight: 600; }

/* ── Progress bar ── */
.progress-bar {
    background: #e5e7eb;
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    min-width: 80px;
}

.progress-fill {
    height: 100%;
    border-radius: 99px;
    background: #3b82d4;
    transition: width 0.3s;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #57606a;
}

.empty-state p { margin-bottom: 12px; font-size: 15px; }

/* ── Delete confirm ── */
.confirm-box {
    max-width: 480px;
    margin: 60px auto;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main { margin-left: 200px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.span2 { grid-column: span 1; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
