#logo {
    height: 30px;
}

.icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    background-color: var(--sub-background-color);
}

.icon:hover {
    transition: 1s;
    background-color: var(--secondary-color);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--sub-background-color);
    color: var(--font-color);
}

.logo-container:hover {
    cursor: pointer;
}

.button-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.options-menu {
    position: absolute;
    top: 45px;
    right: 15px;
    background: var(--sub-background-color);
    border: 1px solid var(--secondary-accent-color);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: none;
    text-align: center;
    z-index: 1000;
}

.options-menu-item {
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
}

.options-menu-item a {
    display: block;
    padding: 8px 12px;
    color: var(--font-color);
    text-decoration: none;
}

.options-menu-item:hover {
    background: var(--secondary-accent-color);
    border-radius: 6px;
}

.options-menu-item:hover a {
    text-decoration: none;
}

/* email modal */
.feedback-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.feedback-modal {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 24px;
  width: 400px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  text-align: center;
}

.feedback-modal h2 {
  margin-top: 0;
  color: #333;
}

.feedback-modal textarea {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
  font-family: inherit;
}

.feedback-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.feedback-actions button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

#feedback-cancel {
  background: #ccc;
  color: #222;
}

#feedback-send {
  background: #4CAF50;
  color: white;
}

a {
  color: var(--font-color);
  text-decoration: none;
}

.calculator-button {
  background-image: url("/caddy/images/icons/calculator/calculator-light.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}

.calculator-button:hover {
  transition: 1s;
  background-color: var(--secondary-color);
}

.calculator-button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.header-calculator-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
}

.header-calculator-modal.hidden {
  display: none;
}

.header-calculator-backdrop {
  display: none;
}

.header-calculator-dialog {
  position: relative;
  width: 360px;
  max-width: calc(100vw - 32px);
  margin: 80px auto 0;
  background: var(--sub-background-color);
  color: var(--font-color);
  border: 1px solid var(--secondary-accent-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  resize: both;
  min-width: 320px;
  min-height: 420px;
  pointer-events: auto;
}

.header-calculator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--secondary-accent-color);
}

.header-calculator-header h2 {
  margin: 0;
  font-size: 18px;
}

.header-calculator-close {
  border: none;
  background: transparent;
  color: var(--font-color);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.header-calculator-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: calc(100% - 61px);
  box-sizing: border-box;
}

.header-calculator-display {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--secondary-accent-color);
  background: var(--background-color);
  color: var(--font-color);
  font-size: 24px;
  text-align: right;
}

.header-calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  flex: 1;
}

.header-calculator-key {
  min-height: 48px;
  border: 1px solid var(--secondary-accent-color);
  border-radius: 8px;
  background: var(--background-color);
  color: var(--font-color);
  font-size: 18px;
  cursor: pointer;
}

.header-calculator-key:hover {
  background: var(--secondary-color);
}

.header-calculator-zero {
  grid-column: span 2;
}

.header-calculator-equals {
  grid-column: span 1;
}

.header-calculator-operator,
.header-calculator-action,
.header-calculator-equals {
  font-weight: 700;
}

#header-calculator-drag-handle {
  cursor: move;
  user-select: none;
}

#header-calculator-dialog {
  position: relative;
}

#header-calculator-dialog.is-dragging {
  cursor: move;
}

.role-picker-button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.role-preview-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10002;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  background: var(--primary-color);
  color: var(--background-color);
  border-radius: 10px;
  box-shadow: 0 6px 20px var(--shadow);
  font-size: 13px;
  font-weight: 600;
}

.role-preview-banner-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-preview-banner-stop {
  flex: 0 0 auto;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  background: var(--background-color);
  color: var(--font-color);
  font-weight: 600;
  cursor: pointer;
}

.role-preview-banner-stop:hover {
  background: var(--secondary-accent-color);
}

.role-preview-banner-stop:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Side rail */

/* Reserve the collapsed gutter only on pages that render the rail. */
/* --side-rail-width drives both the reserved gutter and the rail itself so they stay in sync. */
body.has-side-rail {
    --side-rail-width: 62px;
    padding-left: var(--side-rail-width);
}

/* Keep the header full width across the top so the logo stays in the corner. */
/* Stick it to the top on scroll (like the fixed rail). */
body.has-side-rail .header {
    box-sizing: border-box;
    margin-left: calc(-1 * var(--side-rail-width));
    width: calc(100% + var(--side-rail-width));
    position: sticky;
    top: 0;
    z-index: 950;
}

/* --side-rail-top is set from the header's measured height so the rail starts just below it. */
.side-rail {
    position: fixed;
    left: 0;
    top: var(--side-rail-top, 46px);
    height: calc(100vh - var(--side-rail-top, 46px));
    width: var(--side-rail-width);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 6px;
    box-sizing: border-box;
    background-color: var(--sub-background-color);
    border-right: 1px solid color-mix(in srgb, var(--font-color) 20%, transparent);
    transition: width .18s ease;
    z-index: 900;
}

/* Expand on hover, and for keyboard users tabbing into a link. */
.side-rail:hover,
.side-rail:focus-within {
    width: 220px;
}

.side-rail-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid transparent;
    color: var(--font-color);
    text-decoration: none;
    white-space: nowrap;
}

/* Fade the outline in slowly on hover, snap back on leave (like the header buttons). */
.side-rail-link:hover {
    transition: .5s;
    border-color: var(--primary-accent-color);
}

.side-rail-link.is-active {
    border-color: var(--primary-accent-color);
    background-color: var(--accent-color);
}

.side-rail-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
}

.side-rail-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Swap the PNG icons to their light-on-dark variants in dark mode. */
body.dark .side-rail-img-home {
    content: url('/caddy/images/icons/home/dark mode home.png');
}

body.dark .side-rail-img-admin {
    content: url('/caddy/images/icons/menu/dark-admin.png');
}

body.dark .side-rail-img-metrics {
    content: url('/caddy/images/icons/home/metrics-dark.png');
}

body.dark .side-rail-img-actions {
    content: url('/caddy/images/icons/home/actions-dark.png');
}

body.dark .side-rail-img-projects {
    content: url('/caddy/images/icons/home/projects-dark.png');
}

body.dark .side-rail-img-approvals {
    content: url('/caddy/images/icons/menu/dark-approval.png');
}

body.dark .side-rail-img-logout {
    content: url('/caddy/images/icons/logout/dark logout.png');
}

/* Push logout to the very bottom of the rail, away from the nav links. */
.side-rail-logout {
    margin-top: auto;
}

.side-rail-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--header-color);
    opacity: 0;
    transition: opacity .12s ease;
}

/* Reveal the labels once the rail is expanded. */
.side-rail:hover .side-rail-label,
.side-rail:focus-within .side-rail-label {
    opacity: 1;
}

/* Phone: touch has no hover, so the collapsed hover-rail becomes a fixed bottom tab bar. */
@media (max-width: 768px) {
    /* Drop the left gutter and reserve room at the bottom for the tab bar instead. */
    body.has-side-rail {
        --side-rail-width: 0px;
        padding-left: 0;
        padding-bottom: 60px;
    }

    /* Re-anchor the rail across the bottom as a row of tappable tabs. */
    .side-rail {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        flex-direction: row;
        justify-content: space-around;
        align-items: stretch;
        gap: 2px;
        padding: 6px 4px;
        border-right: none;
        border-top: 1px solid color-mix(in srgb, var(--font-color) 20%, transparent);
        overflow-x: auto;
        overflow-y: hidden;
    }

    /* Hover/focus must not widen the bar the way it does on desktop. */
    .side-rail:hover,
    .side-rail:focus-within {
        width: 100%;
    }

    .side-rail-link {
        flex: 1 1 0;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        padding: 4px 6px;
        min-width: 56px;
    }

    /* Logout is just another tab here, not pinned to the far end. */
    .side-rail-logout {
        margin-top: 0;
    }

    .side-rail-icon {
        width: 26px;
        height: 26px;
    }

    .side-rail-img {
        width: 22px;
        height: 22px;
    }

    /* Labels always show, shrunk to sit under each icon. */
    .side-rail-label {
        opacity: 1;
        font-size: 10px;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
    }

    /* Keep the role-preview banner clear of the bottom tab bar. */
    .role-preview-banner {
        bottom: 72px;
    }
}
