/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:       #008060;
    --green-light: #e6f4f0;
    --green-dark:  #004c3f;
    --grey-50:     #f9fafb;
    --grey-100:    #f3f4f6;
    --grey-200:    #e5e7eb;
    --grey-400:    #9ca3af;
    --grey-600:    #6b7280;
    --grey-800:    #1f2937;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --max-w:       760px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--grey-800);
    background: var(--grey-100);
    min-height: 100vh;
}

/* ── Page header ── */
.page-header {
    background: #fff;
    border-bottom: 1px solid var(--grey-200);
    padding: 18px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--grey-800);
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 13px;
    color: var(--grey-600);
    margin-top: 1px;
}

/* ── Lock button ── */
.lock-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--grey-200);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--grey-400);
    transition: border-color .15s, color .15s, background .15s;
}
.lock-btn:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-light);
}
.lock-btn.is-owner {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-light);
}

/* ── Auth panel ── */
.auth-panel {
    background: #fff;
    border-bottom: 1px solid var(--grey-200);
    padding: 14px 24px;
}

.auth-panel > * {
    max-width: var(--max-w);
    margin: 0 auto;
}

.auth-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--grey-600);
    display: block;
    margin-bottom: 6px;
}

.auth-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-row input[type="password"] {
    flex: 1;
    max-width: 260px;
    padding: 8px 12px;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.auth-row input[type="password"]:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,128,96,.1);
}

.btn-login {
    padding: 8px 16px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.btn-login:hover { background: var(--green-dark); }

.auth-error {
    margin-top: 8px;
    font-size: 13px;
    color: #dc2626;
}

.auth-owner {
    display: flex;
    align-items: center;
    gap: 12px;
}
.auth-owner-label {
    font-size: 13px;
    color: var(--green);
    font-weight: 500;
}
.btn-logout {
    padding: 5px 12px;
    background: none;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--grey-600);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.btn-logout:hover {
    border-color: #dc2626;
    color: #dc2626;
}

/* ── Progress ── */
.progress-wrap {
    max-width: var(--max-w);
    margin: 24px auto 0;
    padding: 0 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--grey-600);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.progress-count {
    font-size: 13px;
    color: var(--grey-600);
}

.progress-bar-bg {
    background: var(--grey-200);
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 99px;
    transition: width .4s ease;
    min-width: 0;
}

.progress-pct {
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
    margin-top: 4px;
}

/* ── Toolbar ── */
.checklist-toolbar {
    max-width: var(--max-w);
    margin: 16px auto 0;
    padding: 0 16px;
    display: flex;
    justify-content: flex-end;
}

.btn-toggle-all {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    color: var(--grey-400);
    cursor: pointer;
    transition: color .15s;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.btn-toggle-all:hover { color: var(--green); }

/* ── Checklist sections ── */
.checklist {
    max-width: var(--max-w);
    margin: 20px auto 40px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section {
    background: #fff;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    gap: 12px;
    transition: background .12s;
}
.section-header:hover { background: var(--grey-50); }
.section-header::-webkit-details-marker { display: none; }

/* Collapse arrow via ::before pseudo */
.section-header::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--grey-400);
    border-bottom: 2px solid var(--grey-400);
    transform: rotate(45deg);
    transition: transform .2s;
    flex-shrink: 0;
    margin-right: 2px;
    margin-top: -3px;
}

details:not([open]) .section-header::before {
    transform: rotate(-45deg);
    margin-top: 2px;
}

.section-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--grey-800);
}

.section-progress {
    font-size: 12px;
    font-weight: 500;
    color: var(--grey-400);
    background: var(--grey-100);
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

/* ── Item list ── */
.item-list {
    list-style: none;
    border-top: 1px solid var(--grey-100);
}

.item {
    border-bottom: 1px solid var(--grey-100);
    transition: background .1s;
}
.item:last-child { border-bottom: none; }
.item:hover { background: var(--grey-50); }
.item--checked { background: var(--green-light); }
.item--checked:hover { background: #d4ede6; }

.item-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 18px;
    cursor: pointer;
    width: 100%;
}

.item-label--readonly {
    cursor: default;
}

/* ── Checkbox styling ── */
.item-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 2px solid var(--grey-400);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    margin-top: 1px;
    transition: background .15s, border-color .15s;
    position: relative;
}

.item-checkbox:checked {
    background: var(--green);
    border-color: var(--green);
}

.item-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Override browser's greyed-out disabled style */
.item-checkbox:disabled {
    opacity: 1;
    cursor: default;
}
.item-checkbox:disabled:not(:checked) {
    border-color: var(--grey-200);
    background: var(--grey-50);
}

/* ── Item text ── */
.item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-size: 14px;
    color: var(--grey-800);
    transition: color .15s;
}

.item--checked .item-name {
    color: var(--grey-400);
    text-decoration: none;
}

.item-note {
    font-size: 12px;
    color: var(--grey-400);
}

/* ── Footer ── */
.page-footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 12px;
    color: var(--grey-400);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .page-header { padding: 14px 16px; }
    h1 { font-size: 17px; }
    .auth-panel { padding: 12px 16px; }
    .progress-wrap { padding: 0 12px; }
    .checklist { padding: 0 12px; }
    .item-label { padding: 11px 14px; }
    .section-header { padding: 12px 14px; }
}
