/* =========================================================================
   Design tokens
   Palette: slate navy (structure) + indigo (action) + status semantics
   Type: Space Grotesk (display/headings) + Inter (body) + JetBrains Mono (data)
   ========================================================================= */
:root {
    --navy-950: #12172a;
    --navy-900: #171d33;
    --navy-800: #212842;
    --navy-700: #2c3557;
    --navy-100: #eef0f8;

    --bg: #f5f6fb;
    --surface: #ffffff;
    --border: #e3e6f0;

    --ink: #171d33;
    --ink-soft: #5a6180;
    --ink-faint: #8b91ab;

    --indigo: #4f5fe0;
    --indigo-dark: #3c4bc4;
    --indigo-soft: #eceeff;

    --green: #1f9d6e;
    --green-soft: #e4f7ef;
    --amber: #c47f0a;
    --amber-soft: #fdf1dd;
    --red: #d64545;
    --red-soft: #fbe8e8;
    --purple: #7c53c9;
    --purple-soft: #f1eafb;
    --slate-soft: #eceef5;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(23, 29, 51, 0.06);
    --shadow-md: 0 8px 24px rgba(23, 29, 51, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, .display {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--navy-950);
    margin: 0 0 4px;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

a { color: var(--indigo); text-decoration: none; }
a:hover { color: var(--indigo-dark); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--navy-950);
    color: #c4c9e0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-brand .mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--indigo), #7c53c9);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700; color: #fff; font-size: 15px;
}
.sidebar-brand .name { font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: #fff; font-size: 15px; }
.sidebar-brand .sub { font-size: 11px; color: #7b82a3; margin-top: 1px; }

.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.sidebar-section-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
    color: #5c6389; padding: 14px 10px 6px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: #b7bcd8; font-size: 13.5px; font-weight: 500;
    margin-bottom: 2px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: var(--indigo); color: #fff; }
.sidebar-nav a .icon { width: 17px; text-align: center; opacity: 0.9; }

.sidebar-footer {
    padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--indigo-soft); color: var(--indigo-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12.5px; flex-shrink: 0;
    font-family: 'Space Grotesk', sans-serif;
}
.sidebar-footer .u-name { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.25; }
.sidebar-footer .u-role { color: #7b82a3; font-size: 11px; }
.sidebar-footer .logout-link { margin-left: auto; color: #7b82a3; font-size: 15px; }
.sidebar-footer .logout-link:hover { color: #fff; }

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 5;
}
.topbar .eyebrow { font-size: 12px; color: var(--ink-faint); font-weight: 500; margin-bottom: 2px; }
.topbar h1 { font-size: 20px; margin: 0; }

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

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-header {
    padding: 16px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2, .card-header h3 { font-size: 15.5px; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr !important; } }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.two-col-even { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) {
    .two-col, .two-col-even { grid-template-columns: 1fr !important; }
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card .stat-num { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; color: var(--navy-950); }
.stat-card .stat-label { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.stat-card .stat-icon {
    position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-blue { background: var(--indigo-soft); color: var(--indigo-dark); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-slate { background: var(--slate-soft); color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; font-family: inherit;
    transition: all 0.12s ease;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-dark); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--indigo); color: var(--indigo); }
.btn-danger-outline { background: #fff; border-color: var(--red-soft); color: var(--red); }
.btn-danger-outline:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-icon { width: 34px; height: 34px; padding: 0; }

/* ---------- Forms ---------- */
label { font-size: 13px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 5px; }
.form-group { margin-bottom: 16px; }
.form-control, select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.form-control:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-soft);
}
.form-hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--ink-faint); padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-weight: 600;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-hover:hover { background: var(--bg); }

/* ---------- Kanban board (signature element) ---------- */
.kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(230px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
}
@media (max-width: 1000px) { .kanban { grid-template-columns: repeat(4, 260px); } }
.kanban-col { background: #eef0f7; border-radius: var(--radius-lg); padding: 12px; min-height: 120px; transition: background 0.12s ease, box-shadow 0.12s ease; }
.kanban-col.drag-over { background: var(--indigo-soft); box-shadow: inset 0 0 0 2px var(--indigo); }
.kanban-cards { min-height: 40px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; }
.kanban-col-head .dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; display: inline-block; }
.kanban-col-title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); display: flex; align-items: center; }
.kanban-col-count { font-size: 11.5px; color: var(--ink-faint); background: #fff; border-radius: 20px; padding: 1px 8px; }
.kanban-card {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 13px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
    display: block; color: inherit;
}
.kanban-card.draggable { cursor: grab; }
.kanban-card.draggable:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.35; }
.kanban-card:hover { border-color: var(--indigo); color: inherit; }
.kanban-card .t-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; display: block; }
.kanban-card .t-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--ink-faint); }
.kanban-card .t-deadline.overdue { color: var(--red); font-weight: 600; }

/* ---------- Progress bar ---------- */
.progress-track { background: var(--slate-soft); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--indigo), var(--purple)); height: 100%; border-radius: 20px; }

/* ---------- Misc ---------- */
.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-faint); }
.empty-state .icon { font-size: 30px; margin-bottom: 10px; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; display: flex; align-items: center; gap: 9px; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-danger { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--indigo-soft); color: var(--indigo-dark); }

.comment { display: flex; gap: 10px; padding: 10px 0; align-items: flex-start; }
.comment:last-child { border-bottom: none; }
.comment .bubble { max-width: 78%; }
.comment .meta { font-size: 12px; color: var(--ink-faint); margin-bottom: 4px; }
.comment .meta b { color: var(--ink); }
.comment .text {
    font-size: 13.5px;
    background: var(--slate-soft);
    color: var(--ink);
    padding: 9px 13px;
    border-radius: 4px 14px 14px 14px;
    display: inline-block;
    word-break: break-word;
}
/* Komentar milik sendiri: rata kanan, bubble warna beda, avatar pindah ke kanan */
.comment.comment-self { flex-direction: row-reverse; }
.comment.comment-self .meta { text-align: right; }
.comment.comment-self .text {
    background: var(--indigo);
    color: #fff;
    border-radius: 14px 4px 14px 14px;
    text-align: left;
}
.comment.comment-self .text a { color: #fff; text-decoration: underline; }
.comment-image { max-width: 260px; max-height: 220px; border-radius: 10px; margin-top: 8px; display: block; border: 1px solid var(--border); object-fit: cover; }
.comment-file-row {
    display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: 10px; max-width: 280px; color: inherit;
}
.comment-file-row:hover { border-color: var(--indigo); color: inherit; }
.comment-file-name { font-size: 12.5px; font-weight: 600; display: block; word-break: break-word; }

.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: none; }
.file-row .f-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--indigo-soft); color: var(--indigo-dark); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.tab-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab-nav a { padding: 10px 4px; font-size: 13.5px; font-weight: 600; color: var(--ink-faint); border-bottom: 2px solid transparent; margin-right: 18px; }
.tab-nav a.active { color: var(--indigo); border-bottom-color: var(--indigo); }

/* ---------- Auth page ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--navy-950);
    background-image: radial-gradient(circle at 20% 20%, rgba(124,83,201,0.25), transparent 40%),
                       radial-gradient(circle at 80% 80%, rgba(79,95,224,0.25), transparent 40%);
    padding: 20px;
}
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: var(--radius-lg); padding: 34px 32px; box-shadow: var(--shadow-md); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand .mark { width: 36px; height: 36px; background: linear-gradient(135deg, var(--indigo), #7c53c9); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Space Grotesk', sans-serif; font-weight: 700; }
.auth-demo { background: var(--indigo-soft); border-radius: 10px; padding: 12px 14px; font-size: 12px; color: var(--navy-800); margin-top: 18px; line-height: 1.6; }

/* ---------- Mobile top bar & sidebar drawer ---------- */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--navy-950);
    position: sticky;
    top: 0;
    z-index: 40;
}
.mobile-menu-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.mobile-topbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 14.5px; }
.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: #b7bcd8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    margin-left: auto;
    padding: 0 2px;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18, 23, 42, 0.55);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.open { display: block; opacity: 1; }

@media (max-width: 860px) {
    .mobile-topbar { display: flex; }
    .sidebar { position: fixed; top: 0; left: -260px; height: 100vh; width: 260px; z-index: 50; transition: left 0.2s ease; }
    .sidebar.open { left: 0; }
    .sidebar-close-btn { display: block; }
    .content { padding: 14px; }
    .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
    .topbar h1 { font-size: 17px; }
    .card-header { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
    .card-pad { padding: 16px; }
    table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    th, td { padding: 10px 12px; }
    .form-hint, .text-faint { word-break: break-word; white-space: normal; }
}