@import url('https://fonts.googleapis.com/css2?family=Huninn&display=swap');

:root {
    --primary: #4c543c;
    --primary-dark: #363d29;
    --primary-tint: #e7eadf;
    --secondary: #888a85;
    --secondary-tint: #eceeec;
    --accent: #faa307;
    --accent-tint: #fdecc9;
    --accent-text: #8a5c00;
    --danger: #b3401f;
    --danger-tint: #f6e1d7;
    --tested: #3d7a8a;
    --tested-tint: #dbe9ec;
    --bg: #f4f3ef;
    --surface: #ffffff;
    --border: #ddd9ce;
    --text: #2b2e24;
    --text-muted: #7a7c74;
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Huninn', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.4;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 700;
}

button {
    font-family: inherit;
}

/* Form Inputs */
input[type=text],
input[type=tel],
input[type=password],
select,
textarea {
    font-family: inherit;
    font-size: 12.5px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
}

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

.sidebar {
    width: 216px;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.sidebar nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.project-item {
    display: block;
    padding: 8px 16px;
    border-left: 3px solid transparent;
    color: rgba(255, 255, 255, .8);
    font-size: 12.5px;
}

.project-item .pname {
    display: block;
    font-weight: 600;
    color: #fff;
}

.project-item .pmeta {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, .55);
    margin-top: 2px;
}

.project-item.active {
    background: rgba(0, 0, 0, .15);
    border-left-color: var(--accent);
}

.sidebar-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, .15);
}

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

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 2px;
}

.topbar h1 {
    font-size: 15px;
    margin-right: auto;
}

.main .topbar h1 {
    font-size: 16px;
}

/* Content Areas */
.content {
    padding: 14px 16px;
    overflow: auto;
}

.content-980 {
    max-width: 980px;
    margin: 0 auto;
    padding: 14px 16px 40px;
}

.content-760 {
    max-width: 760px;
    margin: 0 auto;
    padding: 14px 16px 50px;
}

.content-720 {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 60px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    color: var(--text);
}

.btn:hover {
    filter: brightness(.97);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #3a2400;
    font-weight: 700;
}

.btn-sm {
    padding: 3px 8px;
    font-size: 11.5px;
}

/* Pills */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.pill-waiting {
    background: var(--secondary-tint);
    color: var(--secondary);
    border-color: var(--secondary);
}

.pill-inprogress {
    background: var(--accent-tint);
    color: var(--accent-text);
    border-color: var(--accent);
}

.pill-tested {
    background: var(--tested-tint);
    color: var(--tested);
    border-color: var(--tested);
}

.pill-done {
    background: var(--primary-tint);
    color: var(--primary);
    border-color: var(--primary);
}

.pill-minor {
    background: var(--secondary-tint);
    color: var(--secondary);
    border-color: var(--secondary);
}

.pill-medium {
    background: var(--accent-tint);
    color: var(--accent-text);
    border-color: var(--accent);
}

.pill-high {
    background: var(--danger-tint);
    color: var(--danger);
    border-color: var(--danger);
}

.pill-closed {
    background: #e5e7eb;
    color: #6b7280;
    border-color: #d1d5db;
}

/* Typography & Utils */
.code {
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--primary);
}

.back-link {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-block;
    margin-bottom: 6px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    margin: 18px 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Chip Filter */
.chip-filter {
    display: inline-flex;
    gap: 4px;
}

.chip-filter button {
    border: 1px solid var(--border);
    background: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    color: var(--text-muted);
    cursor: pointer;
}

.chip-filter button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Data Table */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.data-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.data-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
}

.data-table tbody tr:hover {
    background: var(--primary-tint);
}

/* Task Progress */
.task-progress {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.bar {
    width: 44px;
    height: 5px;
    background: var(--secondary-tint);
    border-radius: 3px;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    background: var(--primary);
}

/* Stat Row */
.stat-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    min-width: 104px;
}

.stat label {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
}

.stat .num {
    font-size: 18px;
    font-weight: 700;
}

/* Meta Grid */
.meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 14px;
}

.meta-chip {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 10px;
    background: var(--surface);
    min-width: 100px;
}

.meta-chip label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.meta-chip .val {
    font-size: 12.5px;
    font-weight: 600;
}

.meta-chip select {
    border: none;
    background: transparent;
    padding: 0;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text);
}

/* Comments */
.task-comments {
    display: none;
    background: var(--bg);
}

.task-comments.open {
    display: table-row;
}

.task-comments td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    white-space: normal;
}

.comment {
    display: flex;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
}

.comment .author {
    font-weight: 700;
}

.comment.admin .author {
    color: var(--primary);
}

.comment.client .author {
    color: var(--tested);
}

.comment .time {
    color: var(--text-muted);
    font-size: 10.5px;
    margin-left: 4px;
}

.comment-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.comment-form input {
    flex: 1;
}

.badge-count {
    display: inline-block;
    background: var(--secondary-tint);
    color: var(--text-muted);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
}

/* Screenshots */
.screenshots {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.screenshots img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Log Table */
.log-table td,
.log-table th {
    font-size: 11.5px;
}

.log-table .arrow {
    color: var(--text-muted);
}

/* Access Card */
.access-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.access-card {
    width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 26px;
}

.access-card .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    margin-right: 6px;
}

.access-card h1 {
    font-size: 16px;
    margin: 0 0 3px;
    font-weight: 700;
}

.access-card p {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0 0 16px;
}

.btn-primary.block {
    width: 100%;
    padding: 9px;
}

.access-footer {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* Task List / Uploads */
.task-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 7px;
    margin-bottom: 5px;
}

.task-item .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    user-select: none;
    font-size: 14px;
}

.task-item input[type=text] {
    flex: 1;
    border: none;
    padding: 2px 4px;
}

.task-item input[type=text]:focus {
    outline: none;
}

.task-item .del-btn {
    border: none;
    background: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 2px 5px;
}

.task-item.dragging {
    opacity: .35;
}

.upload-row {
    display: flex;
    gap: 8px;
}

.upload-slot {
    width: 88px;
    height: 88px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    color: var(--text-muted);
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--surface);
}

.upload-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-slot input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.submit-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 22px;
    gap: 8px;
}

/* Responsive Settings */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .sidebar-header {
        border-bottom: none;
    }

    .sidebar nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .project-item {
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }

    .project-item.active {
        background: transparent;
        border-bottom-color: var(--accent);
        border-left-color: transparent;
    }

    .sidebar-footer {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}