/* ============================================================
 * TaskPanel — design tokens (SLM-style, modrá brand)
 * Minimalistický, žiadne emoji, Lucide ikony, radius 3px
 * ============================================================ */

:root {
    /* Brand — modrá */
    --tp-brand:        #2563eb;
    --tp-brand-hover:  #1e40af;
    --tp-brand-bg:     #eff6ff;
    --tp-brand-border: #bfdbfe;

    /* Text */
    --tp-text:         #0f172a;
    --tp-text-muted:   #64748b;
    --tp-text-inverse: #ffffff;

    /* Pozadia */
    --tp-bg:           #f8fafc;
    --tp-surface:      #ffffff;
    --tp-surface-2:    #f1f5f9;

    /* Okraje */
    --tp-border:       #e2e8f0;
    --tp-divider:      #f1f5f9;

    /* Stavy */
    --tp-success:      #10b981;
    --tp-success-bg:   #d1fae5;
    --tp-success-text: #065f46;

    --tp-warning:      #f59e0b;
    --tp-warning-bg:   #fef3c7;
    --tp-warning-text: #92400e;

    --tp-danger:       #dc2626;
    --tp-danger-bg:    #fee2e2;
    --tp-danger-text:  #991b1b;

    --tp-info:         #2563eb;
    --tp-info-bg:      #dbeafe;
    --tp-info-text:    #1e40af;

    /* Radius — pravidlo Mio: tlačidlá 3px, karty 6px */
    --tp-r-btn:        3px;
    --tp-r-sm:         6px;
    --tp-r-md:         8px;
    --tp-r-lg:         12px;
    --tp-r-pill:       9999px;

    /* Spacing */
    --tp-s-1:          4px;
    --tp-s-2:          8px;
    --tp-s-3:          12px;
    --tp-s-4:          16px;
    --tp-s-5:          20px;
    --tp-s-6:          24px;
    --tp-s-8:          32px;

    /* Typografia */
    --tp-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --tp-font-mono:    ui-monospace, 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Menlo, monospace;
    --tp-fs-xs:        11px;
    --tp-fs-sm:        12px;
    --tp-fs-base:      13px;
    --tp-fs-md:        14px;
    --tp-fs-lg:        16px;
    --tp-fs-xl:        20px;

    /* Shadows */
    --tp-shadow-sm:    0 1px 2px rgba(15,23,42,.04);
    --tp-shadow-md:    0 2px 8px rgba(15,23,42,.06);
    --tp-shadow-lg:    0 10px 32px rgba(15,23,42,.08);

    /* Sidebar */
    --tp-sidebar-w:    240px;
    --tp-topbar-h:     56px;

    /* Transitions */
    --tp-trans:        all .15s ease;
}

/* ============================================================
 * Reset & base
 * ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--tp-font);
    font-size: var(--tp-fs-md);
    color: var(--tp-text);
    background: var(--tp-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code, kbd { font-family: var(--tp-font-mono); }

/* ============================================================
 * App shell
 * ============================================================ */
.tp-app { display: grid; grid-template-columns: var(--tp-sidebar-w) 1fr; min-height: 100vh; }

.tp-sidebar {
    background: var(--tp-surface);
    border-right: 1px solid var(--tp-border);
    padding: var(--tp-s-4) var(--tp-s-3);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.tp-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px var(--tp-s-4);
    font-size: 15px;
    font-weight: 700;
    color: var(--tp-text);
    border-bottom: 1px solid var(--tp-divider);
    margin-bottom: var(--tp-s-3);
}
.tp-sidebar-brand-icon {
    width: 28px; height: 28px;
    background: var(--tp-brand);
    color: #fff;
    border-radius: var(--tp-r-sm);
    display: flex; align-items: center; justify-content: center;
}
.tp-sidebar-version { font-size: 10px; color: var(--tp-text-muted); font-weight: 500; letter-spacing: .04em; }

.tp-sidebar-section { margin-top: var(--tp-s-4); }
.tp-sidebar-section:first-of-type { margin-top: 0; }
.tp-sidebar-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tp-text-muted);
    margin: 0 var(--tp-s-2) var(--tp-s-2);
}

.tp-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: var(--tp-r-btn);
    font-size: var(--tp-fs-base);
    color: var(--tp-text);
    margin-bottom: 1px;
    transition: var(--tp-trans);
}
.tp-nav-item:hover { background: var(--tp-surface-2); }
.tp-nav-item.is-active { background: var(--tp-brand-bg); color: var(--tp-brand-hover); font-weight: 600; }
.tp-nav-item-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tp-nav-item-label > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-nav-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.tp-nav-count {
    font-size: 10px;
    color: var(--tp-text-muted);
    background: var(--tp-surface-2);
    padding: 1px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.tp-nav-item.is-active .tp-nav-count { background: #fff; color: var(--tp-brand-hover); }

/* Main content */
.tp-main { display: flex; flex-direction: column; min-width: 0; }
.tp-topbar {
    height: var(--tp-topbar-h);
    background: var(--tp-surface);
    border-bottom: 1px solid var(--tp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--tp-s-6);
    position: sticky; top: 0; z-index: 10;
}
.tp-topbar-title {
    font-size: var(--tp-fs-lg);
    font-weight: 700;
    color: var(--tp-text);
    display: flex; align-items: center; gap: 10px;
}
.tp-topbar-meta { display: flex; align-items: center; gap: var(--tp-s-3); font-size: var(--tp-fs-sm); color: var(--tp-text-muted); }
.tp-content { padding: var(--tp-s-6); flex: 1; min-width: 0; }

/* ============================================================
 * User menu dropdown
 * ============================================================ */
.tp-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: var(--tp-r-btn);
    background: var(--tp-surface-2);
    border: 1px solid var(--tp-border);
    cursor: pointer;
    transition: var(--tp-trans);
}
.tp-user:hover { border-color: var(--tp-brand); }
.tp-user-avatar {
    width: 26px; height: 26px;
    background: var(--tp-brand);
    color: #fff;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.tp-user-name { font-size: var(--tp-fs-sm); font-weight: 600; color: var(--tp-text); }

.tp-dropdown {
    position: absolute; top: calc(100% + 4px); right: 0;
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-sm);
    box-shadow: var(--tp-shadow-lg);
    min-width: 220px;
    overflow: hidden;
    z-index: 100;
    display: none;
}
.tp-dropdown.is-open { display: block; }
.tp-dropdown-meta { padding: var(--tp-s-3) var(--tp-s-4); border-bottom: 1px solid var(--tp-divider); font-size: var(--tp-fs-xs); color: var(--tp-text-muted); }
.tp-dropdown-meta strong { color: var(--tp-text); font-size: var(--tp-fs-sm); display: block; margin-bottom: 2px; }
.tp-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px var(--tp-s-4);
    font-size: var(--tp-fs-sm);
    color: var(--tp-text);
    background: transparent;
    border: 0; width: 100%; text-align: left;
    cursor: pointer; transition: var(--tp-trans);
}
.tp-dropdown-item:hover { background: var(--tp-surface-2); }
.tp-dropdown-item.is-danger { color: var(--tp-danger); }

/* ============================================================
 * Filter chips
 * ============================================================ */
.tp-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--tp-s-5); align-items: center; }
.tp-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-pill);
    font-size: var(--tp-fs-sm);
    color: var(--tp-text-muted);
    cursor: pointer;
    transition: var(--tp-trans);
}
.tp-chip:hover { border-color: var(--tp-text-muted); color: var(--tp-text); }
.tp-chip.is-active { background: var(--tp-brand); color: #fff; border-color: var(--tp-brand); }
.tp-chip-badge {
    background: rgba(15,23,42,.08);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.tp-chip.is-active .tp-chip-badge { background: rgba(255,255,255,.25); }

/* ============================================================
 * Cards & tasks
 * ============================================================ */
.tp-card {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-md);
    padding: var(--tp-s-5) var(--tp-s-6);
    box-shadow: var(--tp-shadow-sm);
}
.tp-card-title { font-size: var(--tp-fs-md); font-weight: 700; color: var(--tp-text); margin: 0 0 var(--tp-s-3); }

.tp-task {
    display: flex; gap: var(--tp-s-4); align-items: flex-start;
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-md);
    padding: var(--tp-s-4) var(--tp-s-5);
    margin-bottom: var(--tp-s-2);
    transition: var(--tp-trans);
    text-decoration: none;
    color: inherit;
}
.tp-task:hover { border-color: var(--tp-brand); transform: translateY(-1px); box-shadow: var(--tp-shadow-md); }
.tp-task.is-done { opacity: .55; }
.tp-task-color { width: 3px; align-self: stretch; border-radius: 2px; flex-shrink: 0; min-height: 30px; }
.tp-task-main { flex: 1; min-width: 0; }
.tp-task-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: var(--tp-s-1); }
.tp-task-head-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tp-task-head-right { font-size: var(--tp-fs-xs); color: var(--tp-text-muted); font-variant-numeric: tabular-nums; }
.tp-task-content { font-size: var(--tp-fs-md); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.tp-task-meta { display: flex; gap: var(--tp-s-3); flex-wrap: wrap; font-size: var(--tp-fs-xs); color: var(--tp-text-muted); margin-top: var(--tp-s-2); align-items: center; }
.tp-task-meta-chunk { display: inline-flex; align-items: center; gap: 4px; }
.tp-task-id { font-family: var(--tp-font-mono); font-size: var(--tp-fs-xs); color: var(--tp-text-muted); }

/* ============================================================
 * Status & priority badges
 * ============================================================ */
.tp-status {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tp-status.open         { background: var(--tp-warning-bg); color: var(--tp-warning-text); }
.tp-status.in_progress  { background: var(--tp-info-bg); color: var(--tp-info-text); }
.tp-status.done         { background: var(--tp-success-bg); color: var(--tp-success-text); }
.tp-status.wontfix      { background: var(--tp-surface-2); color: var(--tp-text-muted); }

.tp-priority {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: inline-flex; align-items: center; gap: 3px;
}
.tp-priority.low      { color: var(--tp-text-muted); }
.tp-priority.normal   { color: var(--tp-text-muted); }
.tp-priority.high     { color: var(--tp-warning); }
.tp-priority.urgent   { color: var(--tp-danger); }

/* ============================================================
 * Forms & buttons
 * ============================================================ */
.tp-form-group { margin-bottom: var(--tp-s-3); }
.tp-label {
    display: block;
    font-size: var(--tp-fs-xs);
    font-weight: 600;
    color: var(--tp-text);
    margin-bottom: var(--tp-s-1);
}
.tp-input, .tp-select, .tp-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-btn);
    font-family: inherit;
    font-size: var(--tp-fs-md);
    color: var(--tp-text);
    background: var(--tp-surface);
    outline: none;
    transition: var(--tp-trans);
}
.tp-input:focus, .tp-select:focus, .tp-textarea:focus {
    border-color: var(--tp-brand);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.tp-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

.tp-btn {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center;
    padding: 8px 14px;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-r-btn);
    background: var(--tp-surface);
    color: var(--tp-text);
    font-size: var(--tp-fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--tp-trans);
    text-decoration: none;
}
.tp-btn:hover { border-color: var(--tp-text); }
.tp-btn-sm { padding: 5px 10px; font-size: var(--tp-fs-xs); }
.tp-btn-primary { background: var(--tp-brand); border-color: var(--tp-brand); color: #fff; }
.tp-btn-primary:hover { background: var(--tp-brand-hover); border-color: var(--tp-brand-hover); }
.tp-btn-success { background: var(--tp-success); border-color: var(--tp-success); color: #fff; }
.tp-btn-success:hover { background: #059669; border-color: #059669; }
.tp-btn-danger { background: var(--tp-danger-bg); border-color: var(--tp-danger-bg); color: var(--tp-danger-text); }
.tp-btn-danger:hover { background: var(--tp-danger); border-color: var(--tp-danger); color: #fff; }
.tp-btn-ghost { background: transparent; border-color: transparent; color: var(--tp-text-muted); }
.tp-btn-ghost:hover { background: var(--tp-surface-2); color: var(--tp-text); }
.tp-btn-icon { padding: 7px; width: 32px; }

/* ============================================================
 * Alerts
 * ============================================================ */
.tp-alert {
    padding: 10px 14px;
    border-radius: var(--tp-r-sm);
    font-size: var(--tp-fs-sm);
    margin-bottom: var(--tp-s-3);
    display: flex; align-items: flex-start; gap: 8px;
    line-height: 1.5;
}
.tp-alert.is-success { background: var(--tp-success-bg); color: var(--tp-success-text); border: 1px solid #a7f3d0; }
.tp-alert.is-error   { background: var(--tp-danger-bg); color: var(--tp-danger-text); border: 1px solid #fecaca; }
.tp-alert.is-info    { background: var(--tp-info-bg); color: var(--tp-info-text); border: 1px solid var(--tp-brand-border); }
.tp-alert.is-warning { background: var(--tp-warning-bg); color: var(--tp-warning-text); border: 1px solid #fde68a; }
.tp-alert-icon { flex-shrink: 0; margin-top: 1px; }

/* ============================================================
 * Empty state
 * ============================================================ */
.tp-empty {
    text-align: center; padding: var(--tp-s-8) var(--tp-s-4);
    color: var(--tp-text-muted);
}
.tp-empty-icon {
    width: 56px; height: 56px;
    background: var(--tp-surface-2);
    border-radius: var(--tp-r-md);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tp-text-muted);
    margin-bottom: var(--tp-s-3);
}
.tp-empty-title { font-size: var(--tp-fs-md); font-weight: 600; color: var(--tp-text); margin-bottom: 4px; }
.tp-empty-sub { font-size: var(--tp-fs-sm); }

/* ============================================================
 * Table
 * ============================================================ */
.tp-table { width: 100%; border-collapse: collapse; }
.tp-table th, .tp-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--tp-divider); }
.tp-table th { font-size: var(--tp-fs-xs); color: var(--tp-text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tp-table td { font-size: var(--tp-fs-sm); }
.tp-table code {
    font-size: var(--tp-fs-xs);
    background: var(--tp-surface-2);
    padding: 2px 6px;
    border-radius: 3px;
}

/* ============================================================
 * Comments & gallery
 * ============================================================ */
.tp-comment {
    padding: var(--tp-s-3) var(--tp-s-4);
    background: var(--tp-surface-2);
    border-left: 3px solid var(--tp-border);
    border-radius: 0 var(--tp-r-sm) var(--tp-r-sm) 0;
    margin-bottom: var(--tp-s-2);
}
.tp-comment.is-claude { border-color: var(--tp-brand); background: var(--tp-brand-bg); }
.tp-comment-head { font-size: var(--tp-fs-xs); color: var(--tp-text-muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.tp-comment-author { font-weight: 600; color: var(--tp-text); }
.tp-comment-content { font-size: var(--tp-fs-base); line-height: 1.5; white-space: pre-wrap; }

.tp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: var(--tp-s-3); }
.tp-gallery a { display: block; }
.tp-gallery img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border: 1px solid var(--tp-border); border-radius: var(--tp-r-sm); cursor: zoom-in; transition: var(--tp-trans); }
.tp-gallery img:hover { border-color: var(--tp-brand); }

/* ============================================================
 * Standalone (login) layout
 * ============================================================ */
.tp-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--tp-bg) 0%, var(--tp-brand-bg) 100%);
    padding: var(--tp-s-5);
}
.tp-auth-box {
    background: var(--tp-surface);
    border-radius: var(--tp-r-lg);
    box-shadow: var(--tp-shadow-lg);
    padding: var(--tp-s-8) 40px;
    width: 100%;
    max-width: 420px;
}
.tp-auth-brand {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: var(--tp-s-2);
}
.tp-auth-brand-icon {
    width: 40px; height: 40px;
    background: var(--tp-brand);
    color: #fff;
    border-radius: var(--tp-r-md);
    display: flex; align-items: center; justify-content: center;
}
.tp-auth-brand-title { font-size: var(--tp-fs-xl); font-weight: 700; color: var(--tp-text); }
.tp-auth-sub { color: var(--tp-text-muted); font-size: var(--tp-fs-base); margin-bottom: var(--tp-s-6); }
.tp-auth-footer { margin-top: var(--tp-s-5); font-size: var(--tp-fs-xs); color: var(--tp-text-muted); text-align: center; line-height: 1.6; }

.tp-magic-link {
    margin-top: var(--tp-s-4);
    padding: var(--tp-s-4);
    background: var(--tp-brand-bg);
    border: 1px solid var(--tp-brand-border);
    border-radius: var(--tp-r-sm);
}
.tp-magic-link-title {
    font-size: var(--tp-fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tp-brand-hover);
    margin-bottom: var(--tp-s-2);
    display: flex; align-items: center; gap: 6px;
}
.tp-magic-link a {
    display: block;
    padding: 10px 12px;
    background: var(--tp-surface);
    border: 1px solid var(--tp-brand-border);
    border-radius: var(--tp-r-btn);
    color: var(--tp-brand);
    font-size: var(--tp-fs-xs);
    word-break: break-all;
    font-family: var(--tp-font-mono);
    transition: var(--tp-trans);
}
.tp-magic-link a:hover { background: var(--tp-brand); color: #fff; border-color: var(--tp-brand); }

/* ============================================================
 * Responsive — mobile sidebar collapse
 * ============================================================ */
.tp-sb-toggle { display: none; padding: 6px; border: 0; background: transparent; cursor: pointer; color: var(--tp-text); border-radius: var(--tp-r-btn); }
.tp-sb-toggle:hover { background: var(--tp-surface-2); }
.tp-sb-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 50; }

@media (max-width: 880px) {
    .tp-app { grid-template-columns: 1fr; }
    .tp-sidebar {
        position: fixed; top: 0; left: 0;
        width: var(--tp-sidebar-w);
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .2s ease;
        height: 100vh;
        box-shadow: var(--tp-shadow-lg);
    }
    .tp-sidebar.is-open { transform: translateX(0); }
    .tp-sb-toggle { display: inline-flex; }
    .tp-sb-backdrop.is-open { display: block; }
}

@media (max-width: 720px) {
    .tp-content { padding: var(--tp-s-4); }
    .tp-topbar { padding: 0 var(--tp-s-4); }
    .tp-auth-box { padding: var(--tp-s-6) var(--tp-s-5); }
    .tp-sidebar { width: 80vw; max-width: 320px; }
}
