:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e3e5e9;
    --primary: #2f6feb;
    --primary-dark: #1f52b5;
    --danger: #d33a3a;
    --success: #1f9d55;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 360px;
}
.login-card h1 { margin-top: 0; font-size: 20px; text-align: center; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-head h1 { margin: 0; font-size: 22px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

.task-row td { border-bottom: none; }
.task-update-row td { padding-top: 0; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], textarea, select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
textarea { resize: none; min-height: 70px; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.checkbox-list label { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.checkbox-list input { width: auto; }

.update-form { display: flex; align-items: flex-start; gap: 8px; }
.update-form select { width: auto; min-width: 130px; }
.update-note { flex: 1; min-height: 34px; }

.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f0f1f3; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; }

form.inline { display: inline; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e6f6ec; color: var(--success); border: 1px solid #bfe8cd; }
.alert-error { background: #fdecec; color: var(--danger); border: 1px solid #f5c2c2; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}
.badge-status-pending { background: #fff2df; color: #9a6400; }
.badge-status-in_progress { background: #e2edff; color: #1f52b5; }
.badge-status-done { background: #e6f6ec; color: var(--success); }
.badge-level-critical { background: #fdecec; color: var(--danger); }
.badge-level-normal { background: #eef0f3; color: var(--muted); }
.badge-level-low { background: #e6f6ec; color: var(--success); }

.tools { display:flex; flex-direction: row; justify-content: space-between; align-items: center; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a {
    padding: 7px 14px;
    border-radius: 100px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}
.tabs a:hover { text-decoration: none; background: #eef0f3; }
.tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.project-title { font-weight: 700; }
.task-desc { max-width: 340px; white-space: pre-line; }

.task-notes { margin-top: 6px; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.task-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border);padding-top: 6px; }
.task-note .badge { font-size: 11px; padding: 1px 7px; }
.task-note-date { white-space: nowrap; }
.task-note-text { flex: 0 0 100%; color: var(--text); }

.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters select { width: auto; }

.brand-logo { height: 28px; width: auto; vertical-align: middle; margin-right: 8px; }
.login-card .brand-logo { height: 44px; display: block; margin: 0 auto 12px; }

.icon { width: 16px; height: 16px; vertical-align: -3px; flex-shrink: 0; }
.btn .icon { margin-right: 6px; }
.btn-icon-only { padding: 7px 8px; line-height: 0; }
.btn-icon-only .icon { margin-right: 0; width: 15px; height: 15px; vertical-align: middle; }

.nav-icon { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }
.topbar-user .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

.badge { display: inline-flex; align-items: center; }
.icon-badge { width: 12px; height: 12px; margin-right: 4px; }

.tabs a .icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 5px; }

@media (max-width: 640px) {
    .topbar-inner { flex-wrap: wrap; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
    td { border: none; padding: 4px 0; }
    td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }

    .task-row { border-bottom: none; padding-bottom: 0; }
    .task-update-row { padding-top: 0; }

    .update-form { flex-direction: column; align-items: stretch; }
}
