/* ============================================================
   HOME MAKER DIARY — Try Swiss Knife
   Follows TSK design system & canonical patterns from
   class-timetable / trip-planner / home-inventory
   ============================================================ */

:root {
    --color-primary: #003d5c;
    --color-accent: #00a8e8;
    --color-accent-hover: #0096c7;
    --color-white: #ffffff;
    --color-background: #f5f7fa;
    --color-border: #e0e6ed;
    --color-text-dark: #1a1a2e;
    --color-text-medium: #555f6d;
    --color-text-light: #8a95a3;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-danger-light: #fef2f2;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.09);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.13);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: linear-gradient(160deg, #f0f4f8 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: var(--color-text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ─── SEO H1 ─── */
.seo-h1 {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* ─── Container ─── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 1.5rem 24px;
}

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
.header {
    width: 100%;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}
.header-logo-link:hover { opacity: 0.85; }

.logo-image {
    height: 36px;
    width: auto;
    display: block;
}

.tool-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a2332;
    white-space: nowrap;
    line-height: 1.2;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text-medium);
    font-family: inherit;
}
.header-icon-btn:hover {
    border-color: var(--color-accent);
    background: var(--color-background);
    color: var(--color-accent);
}
.header-icon-btn svg { width: 20px; height: 20px; }

.lang-short {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-dark);
    letter-spacing: 0.02em;
}
.header-icon-btn:hover .lang-short { color: var(--color-accent); }

/* ─── Language Selector ─── */
.language-selector { position: relative; }

.language-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 140px;
    z-index: 1100;
    overflow: hidden;
}
.language-dropdown.active { display: block; }

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--color-text-dark);
    transition: background 0.15s;
    font-family: inherit;
}
.lang-option:hover { background: var(--color-background); }
.lang-option.active { background: rgba(0,168,232,0.08); color: var(--color-accent); }
.lang-check { font-size: 0.75rem; opacity: 0; transition: opacity 0.15s; }
.lang-option.active .lang-check { opacity: 1; }

/* ─── Menu Button ─── */
.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text-medium);
}
.menu-btn:hover {
    border-color: var(--color-accent);
    background: var(--color-background);
    color: var(--color-accent);
}

/* ═══════════════════════════════════════════
   MENU OVERLAY
═══════════════════════════════════════════ */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-content {
    position: absolute;
    top: 72px;
    right: max(calc((100vw - 1200px) / 2 + 1.5rem), 1.5rem);
    transform: scale(0.9);
    transform-origin: top right;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 16px 20px 18px;
    width: 90%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}
.menu-overlay.active .menu-content {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 600px) {
    .menu-content {
        top: 64px;
        right: 50%;
        transform: translateX(50%) scale(0.9);
        transform-origin: top center;
        width: 92%;
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
    }
    .menu-overlay.active .menu-content {
        transform: translateX(50%) scale(1);
    }
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    gap: 8px;
}
.menu-header h3 { margin: 0; color: var(--color-text-dark); font-size: 1.1rem; }

.menu-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.close-menu {
    background: var(--color-background);
    border: 1px solid var(--color-border);
    font-size: 1.25rem;
    color: var(--color-text-medium);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.15s;
}
.close-menu:hover { background: #fee2e2; color: var(--color-error); border-color: #fca5a5; }

.menu-action {
    width: 100%;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    padding: 11px 14px;
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--color-text-dark);
    font-weight: 500;
    text-align: left;
    font-family: inherit;
}
.menu-action:hover {
    background: var(--color-white);
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.menu-action.danger { color: var(--color-error); border-color: #fca5a5; }
.menu-action.danger:hover { background: var(--color-danger-light); border-color: var(--color-error); }

.action-icon { font-size: 1.35rem; flex-shrink: 0; }
.action-content { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.action-hint { font-size: 0.72rem; color: var(--color-text-light); font-weight: 400; font-style: italic; }

.menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 2px 0 10px;
}

.menu-platform-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════
   INFO BANNER
═══════════════════════════════════════════ */
.info-banner {
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 100%);
    border: 1.5px solid #4fc3f7;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(79, 195, 247, 0.1);
    margin-bottom: 20px;
}
.info-icon { font-size: 1.3rem; flex-shrink: 0; }
.info-text {
    flex: 1;
    color: #01579b;
    font-size: 0.9rem;
    line-height: 1.5;
}
.info-text strong { color: #004d7a; font-weight: 600; }
.info-close {
    background: none;
    border: none;
    color: #01579b;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
    margin-left: auto;
}
.info-close:hover { background: rgba(1, 87, 155, 0.1); color: #004d7a; }

/* ─── Diary full message ─── */
.full-message {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #92400e;
    font-size: 0.9rem;
}
.full-message .info-close { color: #92400e; }
.full-message .info-close:hover { background: rgba(146, 64, 14, 0.1); }

/* ─── Rearrange mode bar ─── */
.rearrange-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(0,168,232,0.08);
    border: 1.5px solid rgba(0,168,232,0.3);
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 14px;
    font-size: 0.875rem;
    color: var(--color-primary);
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 2rem 1.5rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 0.35rem;
}
.empty-hint {
    font-size: 0.9rem;
    color: var(--color-text-medium);
    margin-bottom: 1rem;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* ═══════════════════════════════════════════
   WIDGET GRID — 2 cols mobile, 3 tablet, 4 desktop
═══════════════════════════════════════════ */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    align-items: stretch;
}
@media (max-width: 1024px) { .widget-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .widget-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* ─── Widget card ─── */
.widget-card {
    position: relative;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent); /* overridden inline per widget colour */
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
    user-select: none;
    -webkit-user-select: none;
    min-height: 84px;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.widget-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.widget-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.widget-card-icon { font-size: 1.15rem; flex-shrink: 0; line-height: 1; }
.widget-card-name {
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.widget-card-summary {
    font-size: 0.78rem;
    color: var(--color-text-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Drag handle / rearrange mode ─── */
.widget-drag-handle {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 2px 4px;
    line-height: 1;
    touch-action: none;
}
@media (hover: hover) {
    .widget-card:hover .widget-drag-handle { opacity: 1; }
}
.widget-grid.rearranging .widget-drag-handle { opacity: 1; }
.widget-grid.rearranging .widget-card {
    animation: wiggle 0.35s ease infinite alternate;
}
@keyframes wiggle {
    from { transform: rotate(-0.6deg); }
    to   { transform: rotate(0.6deg); }
}
.widget-card.dragging {
    opacity: 0.4;
    animation: none;
}

/* ─── Add Widget button ─── */
.add-widget-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 14px;
    padding: 12px 14px;
    background: none;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-lg);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.add-widget-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(0,168,232,0.04);
}

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}
.btn-outline {
    background: var(--color-white);
    color: var(--color-text-dark);
    border-color: var(--color-border);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.btn-danger {
    background: var(--color-error);
    color: var(--color-white);
    border-color: var(--color-error);
}
.btn-danger:hover:not(:disabled) { background: #dc2626; border-color: #dc2626; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-text-light);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
    flex-shrink: 0;
}
.icon-btn:hover {
    color: var(--color-accent);
    background: rgba(0,168,232,0.08);
}

/* ═══════════════════════════════════════════
   MODALS (shared shell)
═══════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.hidden { display: none; }

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.modal-content {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}
.modal-content-sm { max-width: 360px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-dark);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0 4px;
    font-family: inherit;
    transition: color 0.15s;
}
.modal-close:hover { color: var(--color-text-dark); }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

.confirm-msg {
    font-size: 0.95rem;
    color: var(--color-text-dark);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

/* Bottom-sheet behaviour on mobile for picker/setup/panel */
@media (max-width: 640px) {
    .modal.hidden { display: none; }
    #modal-type-picker, #modal-setup, #modal-panel {
        align-items: flex-end;
        padding: 0;
    }
    #modal-type-picker .sheet-content,
    #modal-setup .sheet-content,
    #modal-panel .panel-content {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-width: none;
        max-height: 88vh;
        animation: sheetUp 0.25s ease;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    }
}
@keyframes sheetUp {
    from { transform: translateY(40px); opacity: 0.5; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ─── Form elements ─── */
.form-group { margin-bottom: 0.7rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-medium);
    margin-bottom: 4px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--color-text-dark);
    background: var(--color-white);
    transition: border-color 0.2s;
    outline: none;
}
.form-textarea {
    height: auto;
    min-height: 80px;
    padding: 8px 12px;
    resize: vertical;
    line-height: 1.45;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,168,232,0.12);
}
.form-select { cursor: pointer; appearance: auto; }

.payment-config {
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
    padding-top: 12px;
}

/* ═══════════════════════════════════════════
   TYPE PICKER
═══════════════════════════════════════════ */
.type-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 420px) { .type-picker-grid { grid-template-columns: 1fr; } }

.type-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--color-white);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
    transition: border-color 0.15s, background 0.15s;
}
.type-card:hover {
    border-color: var(--color-accent);
    background: rgba(0,168,232,0.04);
}
.type-card-icon { font-size: 1.4rem; line-height: 1.2; flex-shrink: 0; }
.type-card-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-text-dark);
    display: block;
}
.type-card-desc {
    font-size: 0.75rem;
    color: var(--color-text-medium);
    line-height: 1.4;
    display: block;
}

/* ═══════════════════════════════════════════
   COLOUR SWATCHES
═══════════════════════════════════════════ */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected {
    border-color: var(--color-text-dark);
    transform: scale(1.1);
}

/* ═══════════════════════════════════════════
   WIDGET DETAIL PANEL
═══════════════════════════════════════════ */
.panel-content {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    /* background tint set inline per widget colour */
}
.panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.panel-type-icon { font-size: 1.4rem; flex-shrink: 0; }
.panel-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
    line-height: 1.3;
}
.panel-title-input {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font);
    border: 1.5px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    width: 100%;
    outline: none;
}
.panel-type-label {
    font-size: 0.72rem;
    color: var(--color-text-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.panel-menu-wrap { position: relative; }
.panel-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1200;
    overflow: hidden;
}
.panel-menu-item {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    color: var(--color-text-dark);
    transition: background 0.15s;
}
.panel-menu-item:hover { background: var(--color-background); }
.panel-menu-danger { color: var(--color-error); }
.panel-menu-danger:hover { background: var(--color-danger-light); }

.panel-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-background);
}

.panel-body {
    padding: 12px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 100px;
}

/* ─── Panel: shared entry list bits ─── */
.entry-list { list-style: none; }
.entry-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 2px;
    border-bottom: 1px solid var(--color-border);
    min-height: 38px;
}
.entry-row:last-child { border-bottom: none; }
.entry-main { flex: 1; min-width: 0; }
.entry-title {
    font-size: 0.92rem;
    color: var(--color-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-sub {
    font-size: 0.76rem;
    color: var(--color-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-amount {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-text-dark);
    white-space: nowrap;
    flex-shrink: 0;
}
.entry-delete {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 1.1rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    line-height: 1;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}
.entry-delete:hover { color: var(--color-error); background: var(--color-danger-light); }

.panel-empty {
    text-align: center;
    padding: 1.25rem 1rem;
    color: var(--color-text-light);
    font-size: 0.9rem;
    font-style: italic;
}

.panel-add-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.panel-add-row .form-input { flex: 1; }

.panel-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-medium);
    margin: 10px 0 3px;
}

.panel-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.panel-summary-bar strong { font-size: 1.05rem; }

.panel-link-btn {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 0;
}
.panel-link-btn:hover { text-decoration: underline; }

/* ─── To Do ─── */
.todo-row { cursor: pointer; }
.todo-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--color-accent);
    cursor: pointer;
    flex-shrink: 0;
}
.todo-done .entry-title {
    text-decoration: line-through;
    color: var(--color-text-light);
}

/* ─── Lending tabs ─── */
.panel-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}
.panel-tab {
    flex: 1;
    padding: 0.5rem 0.25rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text-medium);
    transition: all 0.15s;
    text-align: center;
}
.panel-tab:hover { border-color: var(--color-accent); color: var(--color-accent); }
.panel-tab.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-white);
}

.settle-btn {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.4);
    color: #15803d;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 100px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    white-space: nowrap;
    transition: background 0.15s;
}
.settle-btn:hover { background: rgba(34,197,94,0.2); }
.settled-badge {
    font-size: 0.72rem;
    color: #15803d;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ─── Add-entry inline forms ─── */
.inline-form {
    border-top: 1px solid var(--color-border);
    margin-top: 10px;
    padding-top: 10px;
}
.inline-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}
.inline-form-row .form-input,
.inline-form-row .form-select { flex: 1; min-width: 0; }

.add-entry-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: none;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.add-entry-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ─── Attendance calendar ─── */
.attendance-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.attendance-month {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-dark);
}
.attendance-summary {
    display: flex;
    gap: 14px;
    justify-content: center;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--color-text-medium);
}
.attendance-summary strong { color: var(--color-text-dark); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-dow {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-light);
    padding: 2px 0;
}
.cal-day {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.72rem;
    color: var(--color-text-medium);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 2px;
    transition: border-color 0.15s;
}
.cal-day:hover:not(:disabled) { border-color: var(--color-accent); }
.cal-day:disabled { opacity: 0.35; cursor: not-allowed; }
.cal-day-blank { border: none; background: none; cursor: default; }
.cal-status { font-size: 0.85rem; line-height: 1; }
.cal-day.status-present { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.5); }
.cal-day.status-absent  { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.45); }
.cal-day.status-half    { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.5); }
.cal-day.today { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* ─── Notes ─── */
.note-entry {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.note-entry:hover { border-color: var(--color-accent); }
.note-date {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--color-text-medium);
    margin-bottom: 2px;
}
.note-text {
    font-size: 0.9rem;
    color: var(--color-text-dark);
    white-space: pre-wrap;
    word-break: break-word;
}
.note-text.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.note-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

/* ─── Contacts ─── */
.contact-search {
    margin-bottom: 10px;
}
.contact-phone {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.contact-phone:hover { text-decoration: underline; }

/* ─── Inventory ─── */
.inv-low { background: rgba(239,68,68,0.05); border-radius: var(--radius-sm); }
.inv-flag { flex-shrink: 0; font-size: 0.8rem; }
.inv-qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.inv-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text-medium);
    line-height: 1;
    transition: all 0.15s;
}
.inv-qty-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.inv-qty-input {
    width: 56px;
    height: 26px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    outline: none;
}
.inv-qty-input:focus { border-color: var(--color-accent); }
.inv-unit { font-size: 0.76rem; color: var(--color-text-light); white-space: nowrap; }

/* ─── Payment ─── */
.payment-info-card {
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 10px;
}
.payment-info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
    padding: 2px 0;
}
.payment-info-row .pi-label { color: var(--color-text-medium); }
.payment-info-row .pi-value { font-weight: 600; color: var(--color-text-dark); text-align: right; }

.mark-paid-btn {
    width: 100%;
    padding: 0.65rem;
    font-size: 1rem;
    margin-bottom: 10px;
}
.mark-paid-btn.paid {
    background: rgba(34,197,94,0.12);
    border-color: rgba(34,197,94,0.4);
    color: #15803d;
    cursor: default;
}

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--color-text-dark);
    color: var(--color-white);
    padding: 0.55rem 1.25rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--color-error); }
.toast-success { background: #15803d; }

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.app-footer {
    text-align: center;
    padding: 1.25rem 0 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
    line-height: 1.6;
}
.footer-link {
    color: var(--color-text-medium);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-link:hover { color: var(--color-accent); }
.footer-separator { margin: 0 6px; color: var(--color-border); }
.version-badge {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: var(--color-text-light);
    cursor: pointer;
    font-family: var(--font);
    padding: 0;
    transition: color 0.15s;
}
.version-badge:hover { color: var(--color-accent); }

/* ═══════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════ */
/* ═══════════════════════════════════════════
   SEO ABOUT SECTION
═══════════════════════════════════════════ */
.about-section {
    max-width: 1200px;
    margin: 0 auto;
    margin-bottom: 0;
}

.about-toggle {
    width: 100%;
    background: transparent;
    border: none;
    border-top: 1px solid #e2e8f0;
    padding: 9px 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    text-align: left;
    font-family: inherit;
}

.about-toggle:hover { color: #64748b; }

.about-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }

.about-icon { font-size: 0.8rem; flex-shrink: 0; }
.about-title { flex: 1; }
.toggle-icon { font-size: 0.65rem; transition: transform 0.3s ease; flex-shrink: 0; }

.about-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 28px 24px;
    margin-top: 4px;
    animation: aboutSlideDown 0.3s ease;
}

@keyframes aboutSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.about-content h2 {
    color: #1a2332;
    font-size: 1.25rem;
    margin-bottom: 20px;
    line-height: 1.4;
    border-bottom: 2px solid #00a8e8;
    padding-bottom: 10px;
}

.about-content h3 {
    color: #1a2332;
    font-size: 1rem;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 24px;
}

.about-column ul,
.about-column ol { margin: 12px 0; padding-left: 22px; }
.about-column li { margin-bottom: 8px; line-height: 1.6; color: #1f2937; }
.about-column li strong { color: #1a2332; }

.how-to-steps { counter-reset: step-counter; list-style: none; padding-left: 0; }
.how-to-steps li {
    counter-increment: step-counter;
    margin-bottom: 18px;
    padding-left: 44px;
    position: relative;
}
.how-to-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0; top: 0;
    background: #00a8e8;
    color: white;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}
.how-to-steps li strong { display: block; margin-bottom: 4px; color: #1a2332; }
.how-to-steps li p { margin: 0; line-height: 1.6; color: #6b7280; }

.features-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.feature-item {
    background: white;
    padding: 14px;
    border-radius: 8px;
    border-left: 3px solid #00a8e8;
}
.feature-item strong { display: block; color: #1a2332; margin-bottom: 5px; font-size: 0.9rem; }
.feature-item p { margin: 0; font-size: 0.85rem; line-height: 1.5; color: #6b7280; }

.use-cases-section { margin-top: 20px; }
.use-cases-section ul { margin-top: 12px; padding-left: 22px; }
.use-cases-section li { margin-bottom: 8px; line-height: 1.6; }
.use-cases-section li strong { color: #1a2332; }

@media (max-width: 768px) {
    .about-grid { grid-template-columns: 1fr; gap: 16px; }
    .about-content { padding: 20px 16px; }
    .features-grid { grid-template-columns: 1fr; }
    .about-toggle { font-size: 0.8rem; padding: 9px 2px; }
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   RESPONSIVE — header (Variant B eyebrow ≤768px)
═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .logo-image { height: 34px; width: auto; }
    .tool-name {
        white-space: normal;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.15;
    }
    .tool-name-eyebrow {
        font-size: 0.85rem;
        font-weight: 600;
        color: #1a2332;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .header-inner { padding: 0.5rem 1rem; }
    .logo-image { height: 30px; width: auto; }
    .tool-name { font-size: 1.2rem; }
    .header-icon-btn { width: 36px; height: 36px; }
    .container { padding: 12px 1rem 24px; }
    .modal-content { padding: 1.25rem; border-radius: var(--radius-lg); }
}
