/* Tacologist Closing Checklist - tablet-optimized styling */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --brand: #d9881e;
    --brand-dark: #a8650c;
    --brand-light: #fcefd0;
    --ok: #1f8f4e;
    --warn: #b27800;
    --danger: #b22020;
    --ink: #1c1c1c;
    --muted: #6b6b6b;
    --bg: #f7f5f2;
    --card: #ffffff;
    --border: #e2ddd6;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
    --radius: 10px;
    --tap: 52px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-dark); }

#appHeader {
    background: var(--brand);
    color: #fff;
    padding: env(safe-area-inset-top) 0 0 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    max-width: 960px;
    margin: 0 auto;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.header-brand img {
    height: 36px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

#appHeader h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.user-badge .link-btn { color: #fff; }

.banner {
    text-align: center;
    padding: 7px 16px;
    font-size: 13px;
}
.banner.offline { background: #d8a40e; color: #2a1f00; }
.banner.syncing { background: #1f8f4e; color: #fff; }

#appMain {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: env(safe-area-inset-bottom);
}

.view-brand {
    display: flex;
    justify-content: center;
    margin: 4px 0 18px 0;
}
.view-brand img {
    max-height: 96px;
    max-width: 70%;
    width: auto;
    height: auto;
    display: block;
}

.view {
    background: transparent;
}

.hidden { display: none !important; }

h2 { margin: 0 0 6px 0; font-size: 20px; }
h3 { margin: 22px 0 10px 0; font-size: 15px; color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }
.status { min-height: 20px; margin-top: 12px; font-size: 14px; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

button {
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
}

.primary-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 12px 20px;
    min-height: var(--tap);
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: background 0.12s ease;
}
.primary-btn:hover:not(:disabled) { background: var(--brand-dark); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.primary-btn.big { width: 100%; padding: 16px; font-size: 16px; }

.secondary-btn {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    min-height: var(--tap);
    font-weight: 500;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--brand-dark);
    text-decoration: underline;
    padding: 8px 4px;
    font-size: 14px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}
.form-row > span { font-size: 13px; color: var(--muted); }
.form-row input,
.form-row select,
.form-row textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 15px;
    min-height: var(--tap);
    background: #fff;
    color: var(--ink);
}
.form-row input:focus,
.form-row select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.checkbox-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
}
.checkbox-row input[type="checkbox"] {
    width: 22px; height: 22px; min-height: 0; flex-shrink: 0;
}

.setup-steps {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 18px 36px;
    margin-bottom: 16px;
}
.setup-steps li { margin: 8px 0; }
code {
    background: #efe9e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    word-break: break-all;
}

.dashboard-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0 24px 0;
}

#queuedSection {
    background: #fff7e6;
    border: 1px solid #f5deaa;
    border-radius: var(--radius);
    padding: 14px;
    margin: 16px 0;
}
#queuedSection h3 { margin-top: 0; }

#queuedList, #historyList {
    list-style: none;
    padding: 0;
    margin: 0;
}
#queuedList li, #historyList li {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
#historyList li button {
    flex-shrink: 0;
}

.checklist-header { margin-bottom: 14px; }

.section-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 16px 0;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: var(--brand-light);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}
.section-header h3 { margin: 0; font-size: 15px; }
.section-progress {
    font-size: 12px;
    color: var(--muted);
    background: #fff;
    border-radius: 999px;
    padding: 4px 10px;
}
.section-progress.complete { color: #fff; background: var(--ok); }

.section-body {
    padding: 8px 16px 16px 16px;
}

.task-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1ece4;
    min-height: 48px;
}
.task-row:last-child { border-bottom: none; }
.task-row label {
    flex: 1;
    font-size: 14px;
    cursor: pointer;
    line-height: 1.4;
}
.task-row input[type="checkbox"] {
    width: 26px; height: 26px; flex-shrink: 0; margin-top: 2px;
}

.photo-block {
    margin-top: 12px;
    padding: 12px;
    background: #faf7f2;
    border: 1px dashed #d2cabd;
    border-radius: 8px;
}
.photo-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.photo-controls input[type="file"] { display: none; }
.photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.photo-thumb {
    position: relative;
    width: 88px; height: 88px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb button {
    position: absolute;
    top: 2px; right: 2px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px; height: 22px;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    padding: 0;
}
.photo-required {
    color: var(--danger);
    font-size: 13px;
    margin-top: 6px;
}

.checklist-footer {
    margin: 24px 0 12px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.signoff-block {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}

.review-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.review-section h4 { margin: 0 0 6px 0; font-size: 14px; }
.review-section ul { margin: 6px 0 0 18px; padding: 0; font-size: 13px; }
.review-section .photo-thumbs { margin-top: 8px; }
.review-section .incomplete { color: var(--warn); font-size: 13px; }

.success-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}
.success-card dl {
    text-align: left;
    margin: 16px 0;
    font-size: 14px;
}
.success-card dt { font-weight: 600; margin-top: 8px; }
.success-card dd { margin: 0 0 6px 0; color: var(--muted); word-break: break-all; }

.history-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.history-controls input { flex: 1; min-height: var(--tap); padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }

@media (min-width: 700px) {
    .dashboard-actions { flex-direction: row; }
    .dashboard-actions button { flex: 1; }
    .checklist-footer { flex-direction: row; justify-content: space-between; align-items: center; }
    .checklist-footer .primary-btn.big { width: auto; flex: 1; }
}
