/* The chart is wide, so this tool uses the whole window rather than the usual 1000px. */
.container:has(.g-app) {
    max-width: none;
    height: 100%;
    min-width: 0;
}

.g-app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0.75rem 1rem 0.5rem;
    gap: 0.5rem;
}

.g-status {
    align-self: center;
    margin-left: 0.8rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.g-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.g-title {
    flex: 0 1 16rem;
    min-width: 8rem;
    padding: 0.2rem 0.3rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--fg);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 600;
}
.g-title:hover,
.g-title:focus {
    border-color: var(--border);
    outline: none;
}

.g-limits,
.g-outcome,
.g-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.g-actions {
    margin-left: auto;
}

.g-limit {
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.g-limit-name {
    align-self: stretch;
    padding: 0 0.5rem;
    border: 0;
    color: #1f2430;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.g-limit-value {
    min-width: 1.4rem;
    text-align: center;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.g-step {
    width: 1.7rem;
    height: 1.7rem;
    background: none;
    border: 0;
    color: var(--fg);
    font-size: 1rem;
    cursor: pointer;
}
.g-step:hover:not(:disabled) {
    background: var(--border);
}
.g-step:disabled {
    color: var(--muted);
    cursor: default;
}

.g-end {
    font-size: 0.9rem;
    color: var(--muted);
}
.g-end strong {
    color: var(--fg);
    font-size: 1rem;
}

.g-chip {
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.8rem;
    color: var(--fg);
}
.g-chip.g-late {
    border-color: #d32f2f;
}

.g-btn {
    padding: 0.3rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--fg);
    font: inherit;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
}
.g-btn:hover {
    border-color: var(--muted);
}
.g-btn.g-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}
.g-btn.g-danger {
    margin-right: auto;
    color: #e5534b;
}

.g-warning {
    padding: 0.35rem 0.6rem;
    border: 1px solid #d32f2f;
    border-radius: 5px;
    font-size: 0.85rem;
}

.g-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

#chart {
    display: block;
    user-select: none;
}

.g-clickable,
.g-row {
    cursor: pointer;
}
.g-clickable:hover rect {
    stroke-width: 2;
}
.g-row:hover .g-row-bg {
    fill: var(--surface);
}

.g-empty {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--muted);
    text-align: center;
}

/* ── Dialogs ── */
.g-dialog {
    position: fixed;
    margin: auto;
    width: min(30rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--fg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.g-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}
.g-dialog h2 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.g-fields {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.g-fields[hidden] {
    display: none;
}

.g-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.g-field-label {
    font-size: 0.8rem;
    color: var(--muted);
}

.g-hint {
    font-size: 0.75rem;
    color: var(--muted);
}

.g-dialog input[type="text"],
.g-dialog input[type="number"],
.g-dialog input[type="date"],
.g-dialog input[type="search"],
.g-dialog select {
    width: 100%;
    padding: 0.3rem 0.45rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--fg);
    font: inherit;
    font-size: 0.9rem;
    color-scheme: light dark;
}
.g-dialog input:disabled {
    opacity: 0.5;
}

.g-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.g-counts label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.g-counts input[type="number"] {
    width: 3.5rem;
}

.g-swatch {
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    color: #1f2430;
    font-size: 0.8rem;
    font-weight: 600;
}

.g-dep-list,
.g-weeks {
    max-height: 11rem;
    overflow: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.3rem 0.45rem;
    font-size: 0.875rem;
}

.g-dep {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0;
}
.g-dep[hidden],
.g-dep-group[hidden] {
    display: none;
}

.g-dep-group {
    margin-top: 0.3rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.g-people {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.g-person {
    display: grid;
    grid-template-columns: 4.5rem 1fr 6rem auto;
    gap: 0.4rem;
}

.g-week {
    display: grid;
    grid-template-columns: 9rem 1fr;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0;
}
.g-week label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.g-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 1rem;
}

/* ── Landing page ── */
.gantt-landing {
    gap: 0.75rem;
    padding: 1rem;
    text-align: center;
}
.gantt-landing p {
    max-width: 30rem;
}
.gantt-landing .g-btn {
    font-size: 1rem;
    padding: 0.5rem 1rem;
}
.gantt-note {
    color: var(--muted);
    font-size: 0.85rem;
}
.gantt-landing h2 {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.gantt-landing ul {
    list-style: none;
}
.gantt-landing a {
    color: var(--accent);
}
