body, html {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: ArtifaktElement;
}

#header, #preview, #overlay {
    position: absolute;
    width: 100%;
}

#header {
    height: 56px;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
}

#preview, #overlay {
    top: 56px;
    bottom: 0;
}

#overlay {
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1em;
    display: none;
}

#overlay > .notification {
    margin: auto;
    padding: 1em;
    max-width: 50%;
    background: white;
}

#header > * {
    height: 2em;
    margin: 0 0.5em;
    font-size: 1em;
    font-family: ArtifaktElement;
}

#header .title {
    flex: 1 0 auto;
    height: auto;
}

#header #user {
    height: auto;
    font-size: 0.85em;
    color: #6b7280;
    white-space: nowrap;
}

#models {
    flex: 0 1 auto;
    min-width: 2em;
}

#dashboard-datagrid-panel {
    border-radius: 12px;
    overflow: hidden;
}

.ds-panel {
    --ds-accent: #ea580c;
    --ds-accent-soft: #fff7ed;
    --ds-border: #e5e7eb;
    --ds-muted: #6b7280;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: calc(100% - 45px);
    padding: 12px;
    box-sizing: border-box;
    background: #fff;
    color: #1f2937;
    font-family: ArtifaktElement, sans-serif;
    font-size: 13px;
}

.ds-panel * { box-sizing: border-box; }
.ds-bar { display: flex; align-items: center; gap: 10px; }
.ds-bar select, .ds-bar input { height: 30px; padding: 0 8px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: inherit; font: inherit; }
.ds-search { flex: 1; min-width: 0; }
.ds-bar label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ds-status { color: var(--ds-muted); font-size: 12px; }
.ds-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 10px; flex: none; height: 290px; } /* fixed: the two lists keep this height; extra panel height goes to the preview */
.ds-box { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--ds-border); border-radius: 8px; overflow: hidden; }
.ds-box > header { display: flex; justify-content: space-between; padding: 6px 10px; background: #f9fafb; border-bottom: 1px solid var(--ds-border); font-weight: 600; font-size: 12px; }
.ds-hint { color: var(--ds-muted); font-weight: 400; font-size: 12px; }
.ds-link { color: var(--ds-accent); cursor: pointer; }
.ds-list { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.ds-grid { display: grid; grid-template-columns: minmax(0, 1fr); } /* one property per line */
.ds-grid .ds-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* long names are shortened with ... instead of a sideways scrollbar */
.ds-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid #f3f4f6; cursor: pointer; }
.ds-row:hover { background: #f9fafb; }
.ds-row.ds-active { background: var(--ds-accent-soft); color: #9a3412; font-weight: 600; }
.ds-row input { accent-color: var(--ds-accent); margin: 0; }
.ds-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-empty { padding: 14px 10px; color: var(--ds-muted); }
.ds-preview-box { flex: 1 1 auto; min-height: 0; }
.ds-preview { flex: 1 1 auto; min-height: 0; overflow: auto; }
.ds-preview table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ds-preview th { text-align: left; padding: 4px 10px; background: #f9fafb; color: var(--ds-muted); font-weight: 500; white-space: nowrap; }
.ds-preview td { padding: 4px 10px; border-top: 1px solid #f3f4f6; white-space: nowrap; }
.ds-footer { display: flex; justify-content: space-between; align-items: center; }
.ds-summary { color: var(--ds-muted); font-size: 12px; }
.ds-actions { display: flex; align-items: center; gap: 8px; }
.ds-logo { height: 22px; margin-right: 6px; }
.ds-btn { padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #374151; font: inherit; font-weight: 600; cursor: pointer; }
.ds-btn:hover { background: #f9fafb; }
.ds-btn-primary { background: var(--ds-accent); border-color: var(--ds-accent); color: #fff; }
.ds-btn-primary:hover { background: #c2410c; }
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: #f9fafb; }
.login-card { width: 22em; max-width: 90vw; padding: 1.5em; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-card label { font-size: 0.85em; color: #6b7280; }
.login-card input { height: 36px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; }
.login-logo { height: 40px; margin-bottom: 0.5em; }
.login-btn { display: block; padding: 9px 14px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #111827; font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
.login-btn:hover { background: #f3f4f6; }
form .login-btn { background: #ea580c; border-color: #ea580c; color: #fff; }
form .login-btn:hover { background: #c2410c; }
.login-or { margin: 12px 0; color: #9ca3af; font-size: 0.85em; }
.login-message { min-height: 1.2em; color: #b91c1c; font-size: 0.9em; }
.login-card [hidden] { display: none; }

/* Toolbar button names under the icons */
.adsk-toolbar.tb-with-labels { height: auto; }
.adsk-toolbar.tb-with-labels > .adsk-control-group { height: auto; }
.adsk-toolbar.tb-with-labels > .adsk-control-group > .adsk-button.tb-labeled { width: 58px; height: auto; margin: 3px 1px; padding: 5px 0 4px; box-sizing: content-box; }
.tb-labeled > .adsk-button-icon { display: block; width: 28px; height: 28px; margin: 0 auto; }
.tb-label { margin-top: 3px; font-size: 11px; line-height: 13px; text-align: center; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tb-labeled.active > .tb-label { color: #2d8ce0; font-weight: 600; }
/* Uno Schedule Export: its own group, wide enough for the whole name, name in saffron */
.adsk-toolbar.tb-with-labels > .adsk-control-group > #dashboard-datagrid-button.tb-labeled { width: 118px; }
#dashboard-datagrid-button > .tb-label, #dashboard-datagrid-button.active > .tb-label { color: #FF9933; font-weight: 700; overflow: visible; text-overflow: clip; }

/* Compact header: logo, title, model picker and the profile button */
#header > #profile { width: 2.2em; height: 2.2em; padding: 0; border: 0; border-radius: 50%; background: #6b7280; color: #fff; font-weight: 600; cursor: pointer; }
#header > #profile:hover { background: #4b5563; }
#header > #profile #avatar { pointer-events: none; }

/* Account panel (slides in from the right) */
#drawer-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.35); }
#drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001; width: 320px; max-width: 90vw; background: #fff; box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25); font-family: ArtifaktElement, sans-serif; animation: drawer-in 0.18s ease-out; }
#drawer[hidden], #drawer-backdrop[hidden] { display: none; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); font-size: 1.15em; }
.drawer-head button { border: 0; background: none; font-size: 1.6em; line-height: 1; color: #6b7280; cursor: pointer; }
.drawer-section { padding: 20px; border-bottom: 1px solid #e5e7eb; }
.drawer-section[hidden] { display: none; }
.drawer-name { font-size: 1.3em; color: #1f2937; word-break: break-word; }
.drawer-email { margin-top: 4px; font-size: 0.85em; color: #4b5563; word-break: break-all; }
.drawer-role { display: inline-block; margin: 8px 0 16px; padding: 2px 10px; border-radius: 10px; background: #f3f4f6; color: #4b5563; font-size: 0.75em; }
.drawer-btn { display: block; width: 100%; margin-top: 10px; padding: 11px 14px; border: 0; border-radius: 4px; font: inherit; font-weight: 600; color: #fff; cursor: pointer; }
.drawer-section .drawer-btn:first-of-type { margin-top: 0; }
.drawer-btn-grey { background: #9ca3af; }
.drawer-btn-grey:hover { background: #6b7280; }
.drawer-btn-blue { background: #0ea5e0; }
.drawer-btn-blue:hover { background: #0284c7; }
.drawer-btn-danger { background: #fff; border: 1px solid #dc2626; color: #dc2626; }
.drawer-btn-danger:hover { background: #fef2f2; }
.drawer-btn:disabled { opacity: 0.5; cursor: default; }

/* Close button on the Schedule Export panel */
.docking-panel .ds-close { position: absolute; top: 8px; right: 12px; z-index: 5; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; color: #6b7280; font-size: 24px; line-height: 1; cursor: pointer; }
.docking-panel .ds-close:hover { background: #f3f4f6; color: #111827; }

/* Views and Sheets panel */
#views-panel { border-radius: 12px; overflow: hidden; }
.vw-panel { height: calc(100% - 45px); overflow: auto; background: #fff; color: #1f2937; font-family: ArtifaktElement, sans-serif; font-size: 13px; }
.vw-status { display: none; padding: 8px 14px; background: #fff7ed; color: #9a3412; font-size: 12px; }
.vw-section { display: flex; justify-content: space-between; padding: 10px 14px 6px; color: #6b7280; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.vw-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; border-left: 3px solid transparent; }
.vw-item:hover { background: #f9fafb; }
.vw-item.vw-active { background: #e0f2fe; border-left-color: #0ea5e0; color: #075985; font-weight: 600; }
.vw-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-empty { padding: 20px 14px; color: #6b7280; }

/* Access requests and administrators in the account panel */
#header > #profile { position: relative; }
#header > #profile.has-badge::after { content: ''; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: #dc2626; border: 2px solid #fff; }
.drawer-note { margin: 0 0 12px; color: #4b5563; font-size: 0.85em; line-height: 1.4; }
.drawer-subtitle { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; color: #6b7280; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.drawer-subtitle:first-child { margin-top: 0; }
.drawer-count { padding: 0 7px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; }
.drawer-count:empty { display: none; }
.drawer-list { color: #6b7280; font-size: 0.85em; }
.acc-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.acc-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1f2937; }
.acc-note { color: #9ca3af; font-size: 0.85em; }
.acc-btn { padding: 4px 10px; border: 1px solid #d1d5db; border-radius: 4px; background: #fff; font: inherit; font-size: 0.85em; cursor: pointer; }
.acc-btn:disabled { opacity: 0.5; cursor: default; }
.acc-btn-approve { border-color: #16a34a; background: #16a34a; color: #fff; }
.acc-btn-approve:hover { background: #15803d; }
.acc-btn-reject { color: #dc2626; border-color: #fca5a5; }
.acc-btn-reject:hover { background: #fef2f2; }

.login-card form a { font-size: 0.85em; text-align: center; color: #0369a1; }
.login-card p { margin: 0 0 8px; font-size: 0.9em; color: #4b5563; }
.login-google { margin-top: 12px; }

.login-body { font-family: ArtifaktElement, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.login-card h2 { font-weight: 600; }

/* Hubs Browser (left side) */
#preview, #overlay { left: 0; }
#hubs-toggle { padding: 0 12px; }
#hubs-panel { display: none; position: absolute; top: 56px; left: 0; bottom: 0; width: 320px; z-index: 2; flex-direction: column; background: #fff; border-right: 1px solid #e5e7eb; font-family: ArtifaktElement, sans-serif; font-size: 13px; color: #1f2937; }
body.hubs-open #hubs-panel { display: flex; }
body.hubs-open #preview, body.hubs-open #overlay { left: 320px; width: calc(100% - 320px); }
.hubs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; }
.hubs-title { font-size: 14px; font-weight: 600; }
.hubs-btn { max-width: 170px; padding: 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #9ca3af; border-radius: 3px; background: #f3f4f6; font: inherit; cursor: pointer; }
.hubs-btn:hover { background: #e5e7eb; }
.hubs-tree { flex: 1; overflow: auto; padding: 8px 6px 16px; }
.hub-list, .hub-children { margin: 0; padding: 0; list-style: none; }
.hub-children { margin-left: 18px; }
.hub-row { display: flex; align-items: center; gap: 5px; padding: 3px 4px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.hub-row:hover { background: #f3f4f6; }
.hub-row.hub-selected { background: #e0f2fe; color: #075985; font-weight: 600; }
.hub-toggle { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 1px solid #9ca3af; border-radius: 3px; font-size: 16px; font-weight: 600; line-height: 1; color: #374151; background: #fff; }
.hub-toggle:empty { border-color: transparent; background: transparent; }
.hub-row:hover .hub-toggle:not(:empty) { border-color: #6b7280; }
.hub-icon { flex: none; display: inline-flex; color: #4b5563; }
.hub-label { overflow: hidden; text-overflow: ellipsis; }
.hub-hint, .hub-error { padding: 6px 10px; color: #6b7280; line-height: 1.4; white-space: normal; }
.hub-error { color: #b91c1c; }

/* Narrow windows */
@media (max-width: 899px) {
    body.hubs-open #preview, body.hubs-open #overlay { left: 0; width: 100%; }
    #hubs-panel { width: min(320px, 88vw); box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25); }
}
@media (max-width: 700px) {
    #header .title { display: none; }
    #header { justify-content: flex-start; gap: 4px; }
    #header > #models { flex: 1 1 0; min-width: 0; max-width: none; }
    #header > .logo { height: 2em; width: auto; }
}
.ds-preview th[draggable="true"] { cursor: grab; user-select: none; }
.ds-preview th.ds-drop { box-shadow: inset 3px 0 0 #f97316; background: #fff7ed; }
/* Keep every icon centred over its name (the Docs icon sat to the left) */
.tb-labeled > .adsk-button-icon { background-position: center center !important; background-repeat: no-repeat !important; -webkit-mask-position: center center !important; mask-position: center center !important; -webkit-mask-repeat: no-repeat !important; mask-repeat: no-repeat !important; }
.tb-labeled > .adsk-button-icon { margin-left: auto !important; margin-right: auto !important; }
.ds-footer .ds-summary { flex: 1; }
.ds-group-by { position: relative; }
.ds-group-by > summary { cursor: pointer; list-style: none; max-width: 190px; overflow: hidden; text-overflow: ellipsis; padding: 3px 8px; border: 1px solid var(--ds-border); border-radius: 6px; background: #fff; }
.ds-group-by > summary::-webkit-details-marker { display: none; }
.ds-group-list { position: absolute; left: 0; bottom: 100%; margin-bottom: 4px; z-index: 5; width: 230px; max-height: 220px; overflow-y: auto; background: #fff; border: 1px solid var(--ds-border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.ds-check { display: flex; align-items: center; gap: 5px; margin-right: 12px; font-size: 12px; white-space: nowrap; cursor: pointer; }

/* Upload / Delete (admins) beside the Hubs button */
#header > #admin-actions { display: flex; align-items: center; gap: 6px; height: 2em; }
#header > #admin-actions[hidden] { display: none; }
.hdr-btn { height: 2em; padding: 0 12px; border-radius: 4px; font: inherit; font-size: 0.9em; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hdr-btn-blue { border: 1px solid #0284c7; background: #0ea5e0; color: #fff; }
.hdr-btn-blue:hover { background: #0284c7; }
.hdr-btn-danger { border: 1px solid #dc2626; background: #fff; color: #dc2626; }
.hdr-btn-danger:hover { background: #fef2f2; }
.hdr-btn:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 700px) { #header > #admin-actions { gap: 3px; } .hdr-btn { padding: 0 7px; font-size: 0.8em; } }
/* With no title text, keep the left items together and push the model picker and profile to the right */
#header { justify-content: flex-start; }
#header > #models { margin-left: auto; }
/* Narrow windows: compact header so the model picker and profile button always stay visible */
@media (max-width: 700px) {
    #header > * { margin: 0 3px; }
    #header > .logo { height: 1.5em; }
    #header > #hubs-toggle { padding: 0 8px; font-size: 0.85em; }
    #header > #admin-actions { gap: 3px; }
    .hdr-btn { padding: 0 6px; font-size: 0.75em; }
    #header > #models { flex: 1 1 60px; min-width: 50px; max-width: none; margin-left: 3px; font-size: 0.85em; }
    #header > #profile { flex: none; width: 2em; height: 2em; margin-right: 6px; }
}
#models:disabled { opacity: 0.5; cursor: not-allowed; background: #f3f4f6; }

/* Header buttons: all the same size and grey; only the selected one is highlighted */
#header > #hubs-toggle, #header > #admin-actions .hdr-btn {
    box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
    width: 100px; height: 2em; padding: 0; border: 1px solid #9ca3af; border-radius: 4px;
    background: #f3f4f6; color: #1f2937; font: inherit; font-size: 0.95em; font-weight: 500; cursor: pointer;
}
#header > #hubs-toggle:hover, #header > #admin-actions .hdr-btn:hover:not(:disabled) { background: #e5e7eb; }
#header > #admin-actions .hdr-btn:disabled { opacity: 0.5; cursor: default; }
/* Selected: Hubs while its panel is open; Upload / Delete while pressed or focused */
body.hubs-open:not(.has-action) #header > #hubs-toggle { background: #0ea5e0; border-color: #0284c7; color: #fff; }
#header > #admin-actions #upload:active, #header > #admin-actions #upload:focus-visible { background: #0ea5e0; border-color: #0284c7; color: #fff; outline: none; }
#header > #admin-actions #delete:active, #header > #admin-actions #delete:focus-visible { background: #dc2626; border-color: #b91c1c; color: #fff; outline: none; }
@media (max-width: 700px) {
    #header > #hubs-toggle, #header > #admin-actions .hdr-btn { width: 54px; flex: none; font-size: 0.8em; }
}

/* Upload / Delete stay highlighted from the click until the action is finished or cancelled */
#header > #admin-actions #upload.hdr-selected, #header > #admin-actions #upload.hdr-selected:disabled { background: #0ea5e0; border-color: #0284c7; color: #fff; opacity: 1; }
#header > #admin-actions #delete.hdr-selected, #header > #admin-actions #delete.hdr-selected:disabled { background: #dc2626; border-color: #b91c1c; color: #fff; opacity: 1; }

/* The Hubs button says "Hubs Viewer"; on narrow windows it is shortened to "Hubs" so everything still fits */
#hubs-toggle .lbl-short { display: none; }
@media (max-width: 700px) {
    #hubs-toggle .lbl-full { display: none; }
    #hubs-toggle .lbl-short { display: inline; }
}
