.igw-htg-wrap {
    --igw-bg: #f7f4ef;
    --igw-card: #ffffff;
    --igw-text: #222222;
    --igw-muted: #777777;
    --igw-border: #e8e2d8;
    --igw-accent: #d8a7a7;
    --igw-soft: #fbf1f1;
    --igw-shadow: 0 18px 45px rgba(30, 25, 20, 0.08);

    width: 100%;
    max-width: 1180px;
    margin: 32px auto;
    padding: 0 16px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--igw-text);
    box-sizing: border-box;
}

.igw-htg-wrap * {
    box-sizing: border-box;
}

.igw-htg-shell {
    background: var(--igw-bg);
    border: 1px solid var(--igw-border);
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--igw-shadow);
}

.igw-htg-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 22px;
}

.igw-htg-title h2 {
    margin: 0 0 6px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--igw-text);
}

.igw-htg-title p {
    margin: 0;
    color: var(--igw-muted);
    font-size: 15px;
}

.igw-htg-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.igw-htg-btn {
    border: 1px solid var(--igw-border);
    background: var(--igw-card);
    color: var(--igw-text);
    border-radius: 999px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    line-height: 1;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
    text-decoration: none;
}

.igw-htg-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0,0,0,.06);
}

.igw-htg-primary {
    background: var(--igw-text);
    color: #ffffff;
    border-color: var(--igw-text);
}

.igw-htg-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 20px;
    align-items: start;
}

.igw-htg-panel,
.igw-htg-preview-card {
    background: var(--igw-card);
    border: 1px solid var(--igw-border);
    border-radius: 24px;
    box-shadow: 0 10px 28px rgba(30, 25, 20, 0.05);
}

.igw-htg-panel {
    padding: 18px;
    position: sticky;
    top: 24px;
}

.igw-htg-field {
    margin-bottom: 18px;
}

.igw-htg-label {
    display: block;
    font-size: 13px;
    font-weight: 750;
    margin-bottom: 8px;
    color: var(--igw-text);
}

.igw-htg-input,
.igw-htg-select {
    width: 100%;
    border: 1px solid var(--igw-border);
    background: #ffffff;
    color: #222222;
    border-radius: 14px;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.igw-htg-input:focus,
.igw-htg-select:focus {
    border-color: var(--igw-accent);
    box-shadow: 0 0 0 4px rgba(216, 167, 167, .18);
}

.igw-htg-habit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.igw-htg-habit-row {
    display: grid;
    grid-template-columns: 1fr 36px;
    gap: 8px;
    align-items: center;
}

.igw-htg-remove {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid var(--igw-border);
    background: var(--igw-soft);
    cursor: pointer;
    color: var(--igw-muted);
    font-size: 18px;
    line-height: 1;
}

.igw-htg-add {
    width: 100%;
    margin-top: 10px;
    background: var(--igw-soft);
    border: 1px dashed var(--igw-accent);
    color: var(--igw-text);
    border-radius: 14px;
    min-height: 42px;
    font-weight: 700;
    cursor: pointer;
}

.igw-htg-small-note {
    color: var(--igw-muted);
    font-size: 12px;
    margin: 8px 0 0;
}

.igw-htg-options {
    border-top: 1px solid var(--igw-border);
    padding-top: 14px;
    margin-top: 4px;
}

.igw-htg-details {
    border: 1px solid var(--igw-border);
    border-radius: 16px;
    padding: 12px;
    background: rgba(255,255,255,.55);
}

.igw-htg-details summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 750;
}

.igw-htg-details .igw-htg-field:first-of-type {
    margin-top: 14px;
}

.igw-htg-preview-card {
    padding: 22px;
    overflow: hidden;
}

.igw-htg-preview-scroll {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
}

.igw-htg-sheet {
    min-width: 980px;
    background: #ffffff;
    border-radius: 24px;
    padding: 28px;
    border: 1px solid var(--igw-border);
    color: #222222;
}

.igw-htg-sheet-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.igw-htg-sheet-title h3 {
    margin: 0;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.igw-htg-sheet-title p {
    margin: 7px 0 0;
    color: #777777;
    font-size: 14px;
}

.igw-htg-month-badge {
    background: var(--igw-soft);
    border: 1px solid var(--igw-border);
    color: #222222;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 750;
    white-space: nowrap;
}

.igw-htg-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    overflow: hidden;
    border: 1px solid var(--igw-border);
    border-radius: 18px;
}

.igw-htg-table th,
.igw-htg-table td {
    border-right: 1px solid var(--igw-border);
    border-bottom: 1px solid var(--igw-border);
    text-align: center;
    height: 36px;
    font-size: 12px;
    padding: 4px;
    background: #ffffff;
    white-space: nowrap;
    min-width: 26px;
}

.igw-htg-table tr:last-child td {
    border-bottom: none;
}

.igw-htg-table th:last-child,
.igw-htg-table td:last-child {
    border-right: none;
}

.igw-htg-table thead th {
    background: var(--igw-soft);
    font-weight: 750;
    color: #333333;
}

.igw-htg-habit-name {
    width: 160px;
    min-width: 160px;
    text-align: left !important;
    padding-left: 12px !important;
    font-weight: 700;
    background: #fffdfb !important;
    word-break: break-word;
}

.igw-htg-dot {
    display: inline-flex;
    width: 17px;
    height: 17px;
    border: 1.6px solid var(--igw-accent);
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    vertical-align: middle;
    background: #ffffff;
}

.igw-htg-dot.is-done {
    background: var(--igw-accent);
    box-shadow: inset 0 0 0 4px #ffffff;
}

.igw-htg-square .igw-htg-dot {
    border-radius: 5px;
}

.igw-htg-footer-line {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    color: #888888;
    font-size: 12px;
}

.igw-htg-theme-minimal {
    --igw-bg: #f7f4ef;
    --igw-card: #ffffff;
    --igw-text: #222222;
    --igw-muted: #777777;
    --igw-border: #e8e2d8;
    --igw-accent: #222222;
    --igw-soft: #f5f2ec;
}

.igw-htg-theme-pastel {
    --igw-bg: #fff6f6;
    --igw-card: #ffffff;
    --igw-text: #2a2424;
    --igw-muted: #8a7474;
    --igw-border: #f0dada;
    --igw-accent: #e7a7b5;
    --igw-soft: #fff0f3;
}

.igw-htg-theme-dark {
    --igw-bg: #141414;
    --igw-card: #1f1f1f;
    --igw-text: #f7f7f7;
    --igw-muted: #b5b5b5;
    --igw-border: #333333;
    --igw-accent: #b9a7ff;
    --igw-soft: #29263a;
}

.igw-htg-theme-dark .igw-htg-input,
.igw-htg-theme-dark .igw-htg-select {
    background: #151515;
    color: #f7f7f7;
    border-color: #333333;
}

.igw-htg-theme-dark .igw-htg-sheet {
    background: #ffffff;
    color: #222222;
}

@media (max-width: 860px) {
    .igw-htg-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .igw-htg-actions {
        justify-content: flex-start;
    }

    .igw-htg-layout {
        grid-template-columns: 1fr;
    }

    .igw-htg-panel {
        position: static;
    }
}

@media print {
    body * {
        visibility: hidden !important;
    }

    #igwHabitTrackerSheet,
    #igwHabitTrackerSheet * {
        visibility: visible !important;
    }

    #igwHabitTrackerSheet {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        border: none !important;
        border-radius: 0 !important;
    }
}
