/* Client Kanban — shell styles */

* { box-sizing: border-box; }

:root {
    --bg: #f2f3f5;
    --surface: #ffffff;
    --border: #d9dce1;
    --text: #1f2328;
    --text-muted: #6b7280;
    --accent: #2f6fda;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

/* --- Top bar and tab strip --- */

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 0.75rem;
    flex: none;
}

.tab-strip {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
}

.tab {
    display: inline-block;
    padding: 0.7rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    font-weight: 500;
}

.tab-active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.topbar-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.5rem;
    flex: none;
}

.topbar-link:hover { color: var(--text); }

.tab-add {
    flex: none;
    align-self: center;
    width: 1.7rem;
    height: 1.7rem;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
}

.tab-add:hover { color: var(--accent); border-color: var(--accent); }

.flash-error {
    background: #fdecec;
    color: #b3261e;
    border-bottom: 1px solid #f5c6c4;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.flash-ok {
    background: #e6f6ec;
    color: #1b7a3d;
    border-bottom: 1px solid #bfe6cc;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* --- Transfer page --- */

.transfer-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.export-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.export-row select {
    flex: 1;
    min-width: 12rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.import-form textarea {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    resize: vertical;
}

.import-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.file-label {
    display: inline-block;
    cursor: pointer;
}

.file-label input[type="file"] { display: none; }

.error-box {
    background: #fdecec;
    color: #b3261e;
    border: 1px solid #f5c6c4;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.error-box ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.preview-actions .btn-quiet { text-decoration: none; }

.tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.tag-new { background: #e6f6ec; color: #1b7a3d; }

.tag-exists { background: var(--bg); color: var(--text-muted); }

.guide {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* --- Board bar: client code, project legend, add-project --- */

.board-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0;
    flex: none;
    flex-wrap: wrap;
}

.board-client {
    font-weight: 700;
    font-size: 0.9rem;
}

.legend {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text);
    cursor: pointer;
}

.legend-chip:hover { border-color: var(--accent); }

.legend-chip-archived { opacity: 0.45; }

.swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    flex: none;
}

.legend-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Board: four columns side by side on desktop and iPad --- */

.board {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    min-height: 0;
    overflow: hidden;
}

.column {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 0;
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex: none;
}

.column-header h2 {
    margin: 0;
    font-size: 0.95rem;
}

.column-tools {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.column-count {
    background: var(--bg);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.column-add {
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.column-add:hover { color: var(--accent); background: #e8eefb; }

.column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- Cards --- */

.card {
    user-select: none;
    -webkit-user-select: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card:hover { border-color: var(--accent); border-left-color: inherit; }

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.4rem;
}

.card-codes {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.card-cal {
    flex: none;
    border: none;
    background: none;
    padding: 0.1rem;
    margin: -0.1rem -0.15rem 0 0;
    color: #c3c9d1;
    cursor: pointer;
    border-radius: 4px;
    line-height: 0;
}

.card-cal:hover { color: var(--accent); background: var(--bg); }

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
}

.card-due {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
}

.card-due.due-hot {
    color: #b3261e;
    background: #fdecec;
    font-weight: 600;
}

/* --- Drag and drop --- */

.card-ghost {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    opacity: 0.92;
    transform: rotate(2deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.card-dragging { display: none; }

.card-placeholder {
    border: 2px dashed var(--accent);
    border-radius: 6px;
    background: #e8eefb;
    opacity: 0.7;
}

.column.drop-target {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    background: #f4f8ff;
}

.toast-error {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translate(-50%, 200%);
    background: #b3261e;
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease;
    z-index: 200;
    max-width: min(90vw, 30rem);
}

.toast-error.toast-show { transform: translate(-50%, 0); }

.field-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}

/* --- Phone: one column at a time, swipe horizontally between them --- */

@media (max-width: 699px) {
    .board {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .column {
        flex: 0 0 calc(100vw - 1.5rem);
        scroll-snap-align: center;
    }
}

/* --- Dialogs and buttons --- */

.app-dialog {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    width: min(92vw, 24rem);
}

.app-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.dialog-form {
    padding: 1.25rem;
}

.dialog-form h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.dialog-form label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.dialog-form input:not([type="color"]),
.dialog-form select,
.dialog-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.5rem 0.6rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.dialog-form textarea[data-autogrow] {
    /* Grows with content between ~3 and ~10 lines; scrolls past the cap. */
    resize: none;
    overflow-y: auto;
    line-height: 1.4;
    min-height: calc(3 * 1.4em + 1rem + 2px);
    max-height: calc(10 * 1.4em + 1rem + 2px);
    font-family: inherit;
}

.dialog-form input[type="color"] {
    display: block;
    margin-top: 0.3rem;
    width: 3.5rem;
    height: 2.2rem;
    padding: 0.15rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.field-static {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.dialog-side {
    padding: 0.6rem 1.25rem 1rem;
    border-top: 1px solid var(--border);
}

.btn-primary,
.btn-quiet,
.btn-danger,
.btn-small,
.btn-icon {
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

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

.btn-primary:hover { filter: brightness(1.05); }

.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    color: #b3261e;
    border-color: #f5c6c4;
}

.btn-danger:hover { background: #fdecec; }

.btn-small {
    flex: none;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-small:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
    padding: 0.15rem 0.45rem;
    font-size: 0.8rem;
}

.btn-icon:disabled { opacity: 0.3; cursor: default; }

/* --- Manage clients screen --- */

.page-scroll {
    overflow-y: auto;
}

.manage {
    max-width: 44rem;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 0.75rem 3rem;
}

.manage-section { margin-bottom: 2rem; }

.manage-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.manage-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.manage-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.client-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
}

.client-row-retired { opacity: 0.75; }

.client-row-order {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: none;
}

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

.client-row-name { font-weight: 600; font-size: 0.95rem; }

.client-row-meta { font-size: 0.78rem; color: var(--text-muted); }

.client-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: none;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* --- Login page --- */

.login-page {
    justify-content: center;
    align-items: center;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem;
    width: min(90vw, 22rem);
}

.login-box h1 {
    margin: 0 0 1.25rem;
    font-size: 1.3rem;
    text-align: center;
}

.login-box label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.login-box input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.login-box button {
    width: 100%;
    padding: 0.65rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.login-box button:hover { filter: brightness(1.05); }

.login-error {
    background: #fdecec;
    color: #b3261e;
    border: 1px solid #f5c6c4;
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    margin: 0 0 1rem;
}
