/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #111;
    color: #e8e8e8;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== PIN SCREEN ===== */
#pin-screen {
    position: fixed; inset: 0;
    background: #111;
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}

.pin-wrap { text-align: center; width: 280px; }

.pin-logo {
    font-size: 52px;
    color: #4ade80;
    display: block;
    margin-bottom: 8px;
    line-height: 1;
}

.pin-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 36px;
    color: #ccc;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 10px;
}

.pin-dots span {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid #333;
    transition: all 0.15s;
}

.pin-dots span.filled {
    background: #4ade80;
    border-color: #4ade80;
    box-shadow: 0 0 8px #4ade8066;
}

.pin-error {
    color: #f87171;
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.pin-key {
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    color: #e8e8e8;
    font-size: 22px;
    font-weight: 400;
    height: 68px;
    cursor: pointer;
    transition: background 0.1s, transform 0.08s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.pin-key:active { background: #2a2a2a; transform: scale(0.94); }
.pin-del { color: #888; font-size: 18px; }
.pin-ok {
    background: #4ade80;
    color: #111;
    border-color: #4ade80;
    font-weight: 700;
    font-size: 24px;
}
.pin-ok:active { background: #22c55e; }

/* ===== MOBILE APP ===== */
body.mobile { height: 100dvh; overflow: hidden; }

#app-screen {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 9px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: #161616;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

.top-bar-title {
    font-size: 14px;
    font-weight: 700;
    color: #4ade80;
    letter-spacing: 0.06em;
}

#btn-sync {
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}

#btn-sync:active { color: #4ade80; border-color: #4ade80; }
#btn-sync:disabled { opacity: 0.4; }

#btn-sync.spinning {
    color: #4ade80;
    border-color: #4ade80;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.tab-panels {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-panel {
    display: none;
    flex-direction: column;
    height: 100%;
    position: absolute;
    inset: 0;
}

.tab-panel.active { display: flex; }

.entries {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.entry-bubble {
    background: #1e1e1e;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 14px;
    max-width: 90%;
    align-self: flex-end;
    word-break: break-word;
}

.entry-text {
    font-size: 15px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.entry-time {
    font-size: 11px;
    color: #555;
    margin-top: 4px;
    text-align: right;
}

.empty-msg {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: #333;
    font-size: 14px;
}

.empty-msg span { font-size: 36px; color: #2a2a2a; }

/* Input Bar */
.input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px 10px;
    background: #1a1a1a;
    border-top: 1px solid #222;
}

.input-bar textarea {
    flex: 1;
    background: #111;
    border: 1px solid #282828;
    border-radius: 22px;
    color: #e8e8e8;
    font-size: 15px;
    line-height: 1.45;
    padding: 10px 16px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 130px;
    overflow-y: auto;
    -webkit-appearance: none;
    transition: border-color 0.15s;
}

.input-bar textarea:focus { border-color: #3a3a3a; }
.input-bar textarea::placeholder { color: #444; }

.btn-send {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: #4ade80;
    color: #111;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, background 0.1s;
}

.btn-send:active { transform: scale(0.9); }
.btn-send:disabled { opacity: 0.4; }

#panel-refleksje .btn-send { background: #60a5fa; }
#panel-sztuka .btn-send    { background: #c084fc; }

/* Tab Bar */
.tab-bar {
    display: flex;
    background: #161616;
    border-top: 1px solid #222;
    padding-bottom: env(safe-area-inset-bottom, 4px);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #555;
    padding: 10px 4px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}

.tab-btn.active { color: #4ade80; }
.tab-btn[data-tab="refleksje"].active { color: #60a5fa; }
.tab-btn[data-tab="sztuka"].active    { color: #c084fc; }

.tab-icon { font-size: 20px; }
.tab-lbl  { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

/* ===== DESKTOP ===== */
body.desktop { min-height: 100vh; background: #0d0d0d; }

.desk-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 28px;
    background: #161616;
    border-bottom: 1px solid #222;
    position: sticky;
    top: 0;
    z-index: 10;
}

.desk-logo {
    font-size: 17px;
    font-weight: 700;
    color: #4ade80;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.desk-tabs { display: flex; gap: 4px; flex: 1; }

.desk-tab {
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 18px;
    transition: all 0.15s;
}

.desk-tab:hover { color: #999; border-color: #2a2a2a; }
.desk-tab.active { color: #e8e8e8; background: #222; border-color: #333; }

.btn-logout {
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #555;
    cursor: pointer;
    font-size: 13px;
    padding: 6px 14px;
    transition: all 0.15s;
}
.btn-logout:hover { color: #999; border-color: #444; }

.desk-main { padding: 24px 28px; max-width: 1440px; margin: 0 auto; }

.desk-section { display: none; gap: 20px; }
.desk-section.active { display: grid; grid-template-columns: 380px 1fr; }

.desk-col {
    background: #161616;
    border: 1px solid #222;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 108px);
}

.col-header {
    padding: 14px 18px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.col-header h3 {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-process {
    background: #4ade80;
    border: none;
    border-radius: 8px;
    color: #111;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-process:hover { background: #22c55e; }
.btn-process:disabled { background: #222; color: #555; cursor: not-allowed; }

.raw-list, .task-list, .notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Raw entries */
.raw-entry {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    color: #bbb;
}

.raw-entry-time { font-size: 11px; color: #444; margin-top: 6px; }

/* Tasks */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    padding: 12px 14px;
    transition: border-color 0.15s;
}

.task-item:hover { border-color: #2a2a2a; }
.task-item.done { opacity: 0.45; }

.task-check {
    width: 20px; height: 20px;
    border: 2px solid #4ade80;
    border-radius: 6px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #111;
    margin-top: 2px;
    background: transparent;
    transition: all 0.15s;
}

.task-check.checked { background: #4ade80; }

.task-body { flex: 1; min-width: 0; }

.task-title {
    font-size: 15px;
    font-weight: 500;
    color: #e8e8e8;
    line-height: 1.45;
}

.task-item.done .task-title { text-decoration: line-through; color: #555; }

.task-desc {
    font-size: 13px;
    color: #666;
    margin-top: 3px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; }

.priority-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.priority-high   { background: #3f0f0f; color: #fca5a5; border: 1px solid #5a1a1a; }
.priority-normal { background: #0f1f3f; color: #93c5fd; border: 1px solid #1a2f5a; }
.priority-low    { background: #1a1a1a; color: #555; border: 1px solid #2a2a2a; }

.task-date { font-size: 11px; color: #444; }

.btn-delete {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
    margin-top: 1px;
}

.btn-delete:hover { color: #f87171; background: #1a0a0a; }

/* Notes */
.note-item {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    padding: 14px;
    transition: border-color 0.15s;
}

.note-item:hover { border-color: #2a2a2a; }

.note-content {
    font-size: 14px;
    line-height: 1.7;
    color: #ddd;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.note-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.tag {
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    color: #777;
    font-size: 11px;
    padding: 2px 8px;
}

.note-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.note-date { font-size: 11px; color: #444; white-space: nowrap; }

/* Misc */
.show-done-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.show-done-label input { accent-color: #4ade80; cursor: pointer; }

.empty-desk {
    color: #333;
    font-size: 13px;
    text-align: center;
    padding: 48px 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    color: #e8e8e8;
    font-size: 14px;
    padding: 12px 22px;
    z-index: 999;
    white-space: nowrap;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
