body {
    height: 100vh;

    margin: 0px;
    background-color: white;
    color: black;
    display: flex;

    font-family: Futura, sans-serif;
    font-size: 12pt;
}

body a { color: inherit; }

h1 { font-size: 24pt; }
h2 {
    font-size: 18pt;
    padding-right: 1em;
}

.secondary_text { color: #7D7D7D; }
.no_underline { text-decoration: none; }

.destructive_action {
    color: red;
    text-decoration: underline;
    cursor: pointer;
    text-underline-offset: 4px;
}

.error {
    color: red;
    font-size: 10pt;
}

code {
    font-family: monospace;
    background-color: white;
    border: 1px solid #ccc;
    padding: 1px 5px;
    border-radius: 3px;
}

/* sidebar + content pane layout */

#sidebar {
    padding-left: 10px;
    width: 100px;
    flex: 10%;
    min-width: 230px;

    overflow: auto;
}

.sidebar_item {
    height: 36px;
    padding-right: 18px;

    cursor: pointer;

    display: flex;
    justify-content: right;
    align-items: center;
}

.active_sidebar_item {
    cursor: default;

    color: black;
    background-color: #ddd;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
}

.new_board {
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 4px;
    color: #7D7D7D;
}

.new_board:hover {
    color: black;
}

.sidebar_item.new_board_form {
    display: block;
    height: auto;
    cursor: default;
    padding-top: 4px;
    padding-bottom: 8px;
}

.new_board_form input[type='text'] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.new_board_form .error {
    display: block;
    margin-bottom: 8px;
}

.sidebar_form_buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

#viewer {
    padding-top: 36px;
    padding-left: 36px;
    padding-right: 36px;
    margin: 0px;
    flex: 90%;

    border-top-left-radius: 36px;
    border-bottom-left-radius: 36px;

    overflow: auto;

    background-color: #ddd;
    color: black;
}

/* landing page (logged out) */

#landing {
    margin: auto;
    width: 400px;
    padding-top: 72px;
    text-align: center;
}

/* board cards on /boards and the landing demo */

#board_list, #demo_board {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.board_card {
    width: 200px;
    padding: 12px;
    padding-left: 18px;
    border: 1px solid black;
    border-radius: 8px;
    background-color: white;
    position: relative;
    overflow: hidden;
}

.board_card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 6px;
    border-radius: 3px;
    background-color: var(--board_accent_color);
}

.board_card_name {
    font-size: 14pt;
}

.board_card_permissions {
    font-size: 10pt;
    margin-top: 4px;
}

.board_card_lanes {
    font-size: 10pt;
    margin-top: 8px;
    line-height: 1.5;
}

.board_header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 24px;
}

.board_header h2 { margin: 0; padding-right: 0; }

/* board context — below the title, above the lanes (board.html) */

.board_context {
    max-width: 800px;
    margin-bottom: 24px;
}

.board_context_preview {
    white-space: pre-wrap; /* preserve the author's line breaks, same reasoning as .ticket_preview */
    font-family: monospace;

    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    line-clamp: 4;
    overflow: hidden;
}

.board_context_full {
    display: none;
    white-space: pre-wrap;
    font-family: monospace;
}

.board_context_expanded .board_context_preview { display: none; }
.board_context_expanded .board_context_full { display: block; }

.board_context_footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.board_context_edit_button {
    font-size: 10pt;
    padding: 2px 8px;
    margin-top: 0;
}

#board_context_input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 100px;
    font-size: 11pt;
    font-family: monospace;
    margin-bottom: 8px;
}

/* board view: lanes side by side, tickets stacked top to bottom */

#lanes {
    display: flex;
    gap: 18px;
    align-items: flex-start;

    position: relative; /* positioning context for .drop_indicator (horizontal, lane reorder) */
}

.lane {
    width: 240px;
    flex-shrink: 0;

    background-color: #eee;
    color: black; /* firewalled from the board's custom fg_color — see #viewer override in board.html */
    border-radius: 8px;
    padding: 12px;
}

/* Shared by the dragged .lane and the dragged .ticket — see itemDragStart in
   board.html. visibility (not display:none) so the source keeps its layout
   space while dragging, so the row/column doesn't reflow as neighbors slide
   into the gap. The browser's own native drag image is what the cursor
   actually carries, at full opacity — this just hides the source copy left
   behind in the DOM so there aren't two visible copies on screen at once. */
.drag_source_hidden {
    visibility: hidden;
}

/* Shared by lane reordering (.drop_indicator_x, horizontal bar) and ticket
   reordering/moving (.drop_indicator_y, vertical bar within a lane).
   position:absolute (never a real flex child) so it never takes up layout
   space — an in-flow indicator would nudge every item sideways/downward each
   time it appears, moves, or disappears. Positioned in JS
   (positionDropIndicator in board.html) via `left`/`top`; accent-colored
   using the board's own accent_color (see --board-accent on #viewer in
   board.html) rather than a fixed color, per board theme customization. */
.drop_indicator {
    position: absolute;
    pointer-events: none;
    border-radius: 2px;
    background-color: var(--board-accent, #3b82f6);
}

.drop_indicator_x {
    top: 0;
    height: 100%;
    width: 4px;
}

.drop_indicator_y {
    left: 0;
    width: 100%;
    height: 4px;
}

.lane_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.lane_name {
    font-size: 12pt;
    font-weight: bold;
}

/* Shared icon-button row, used by both .lane_header and .ticket_header. */
.icon_row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Shared small icon-button styling, used by the lane/ticket drag handles and
   the lane delete (x) icon. */
.action_icon {
    font-size: 13pt;
    line-height: 1;
    color: #7D7D7D;
    cursor: pointer;
}

.drag_handle {
    cursor: grab;
}

.drag_handle:active {
    cursor: grabbing;
}

.lane_delete_icon {
    color: red;
}

.lane_delete_disabled {
    color: #7D7D7D;
    cursor: not-allowed;
}

.lane_tickets {
    display: flex;
    flex-direction: column;
    gap: 8px;

    position: relative; /* positioning context for .drop_indicator (vertical, ticket move) */
}

.lane_empty {
    font-size: 10pt;
}

.lane_add {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 32px;
    padding: 12px;

    background-color: transparent;
    border: 1px dashed #7D7D7D;
    color: #7D7D7D;

    cursor: pointer;
}

.lane_add:hover {
    border-color: black;
    color: black;
}

.lane_add.lane_add_form {
    display: block;
    cursor: default;
    text-align: left;
}

.lane_add_form input[type='text'] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;

    font-size: 12pt;
}

.lane_add_form .error {
    display: block;
    margin-bottom: 8px;
}

.lane_add_buttons {
    display: flex;
    gap: 8px;
}

.ticket {
    background-color: white;
    border: 1px solid black;
    border-radius: 6px;
    padding: 8px;
}

.ticket_header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.ticket_title {
    font-size: 11pt;
}

.ticket_number {
    font-weight: bold;
}

/* single ticket page (ticket.html) */

#ticket_page {
    max-width: 800px;
}

.ticket_preview {
    margin-top: 4px;
    font-size: 10pt;
    color: #7D7D7D;

    white-space: pre-wrap; /* preserve the author's line breaks without needing an HTML-injecting filter */

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
}

.ticket_expand_arrow {
    margin-top: 4px;
    text-align: center;
    font-size: 9pt;
    line-height: 1;
    color: #7D7D7D;
    cursor: pointer;
}

.ticket_expand_arrow:hover {
    color: black;
}

.ticket_comments {
    display: none;
    margin-top: 8px;
}

.ticket_expanded .ticket_preview {
    display: none;
}

.ticket_expanded .ticket_comments {
    display: block;
}

.comment {
    font-size: 10pt;
}

.comment + .comment {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ccc;
}

.previous_comments_link {
    display: block;
    font-size: 10pt;
    margin-bottom: 8px;
}

.previous_comments_link:hover {
    color: black;
}

.comment_body {
    /* markdown-rendered HTML supplies its own line breaks (<p>/<br>, via the
       nl2br extension) -- unlike the old plain-text rendering, this no
       longer needs white-space: pre-wrap to preserve the author's breaks. */
}

.comment_body p {
    margin: 0 0 6px 0;
}

.comment_body p:last-child {
    margin-bottom: 0;
}

.comment_body ul, .comment_body ol {
    margin: 4px 0;
    padding-left: 20px;
}

.comment_body pre {
    overflow-x: auto;
    padding: 6px 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.comment_body pre code {
    background: none;
    border: none;
    padding: 0;
}

.comment_body blockquote {
    margin: 4px 0;
    padding-left: 10px;
    border-left: 3px solid #ccc;
}

/* individual ticket page only -- titles/metadata stay at the default size,
   just the comment body text itself is bumped up for readability */
#ticket_page .comment_body {
    font-size: 13pt;
}

.comment_meta {
    text-align: right;
    font-size: 9pt;
    margin-top: 2px;
}

/* ticket page only -- comments and 'moved' history events share one thread,
   so the divider between consecutive entries applies regardless of kind
   (see #ticket_comments_full in ticket.html) rather than only .comment +
   .comment (board.html's ticket-card comment list never has history_event
   entries mixed in, so that narrower rule stays as-is for it). Comment
   cards below carry their own background/border, so the divider here is
   just spacing, not a border. */
#ticket_comments_full > div + div {
    margin-top: 8px;
}

/* individual ticket page only -- comments get a card treatment so they
   stand out from the 'moved to lane' history entries in the same thread.
   Agent-authored comments are visually distinct (dark) so a reader can't
   mistake an agent's comment for a human's at a glance. */
#ticket_page .comment {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px 12px;
}

#ticket_page .comment_agent {
    background-color: black;
    color: white;
    border-color: black;
}

#ticket_page .comment_agent .comment_meta {
    color: #ccc;
}

#ticket_page .comment_agent .comment_body pre {
    background-color: rgba(255, 255, 255, 0.08);
}

/* inline code inherits the base `code` rule's white background, which is
   invisible against this card's black background + white text; give it a
   dark background of its own (pre code overrides back to none right below,
   since .pre already supplies its own background). */
#ticket_page .comment_agent .comment_body code {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #555;
}

#ticket_page .comment_agent .comment_body pre code {
    background: none;
}

.history_event {
    font-size: 9pt;
    font-style: italic;
}

.add_comment_form {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ccc;
}

.add_comment_form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 50px;
    font-size: 10pt;
}

.add_comment_footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.ticket_add {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 24px;
    padding: 8px;
    margin-bottom: 8px;

    background-color: transparent;
    border: 1px dashed #7D7D7D;
    border-radius: 6px;
    color: #7D7D7D;

    cursor: pointer;
}

.ticket_add:hover {
    border-color: black;
    color: black;
}

.ticket_add.ticket_add_form {
    display: block;
    cursor: default;
    text-align: left;
}

.ticket_add_form input[type='text'] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;

    font-size: 11pt;
}

.ticket_add_form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;

    font-size: 10pt;
    min-height: 120px;
}

.ticket_add_form .error {
    display: block;
    margin-bottom: 8px;
}

/* API docs (docs.html) */

#endpoint_list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 800px;
    margin-top: 24px;
}

.endpoint {
    background-color: white;
    border: 1px solid black;
    border-radius: 6px;
    padding: 12px;
}

.endpoint_header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.endpoint_method {
    font-size: 10pt;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
}

.endpoint_method_get { background-color: #2e7d32; }
.endpoint_method_post { background-color: #1565c0; }
.endpoint_method_put { background-color: #ef6c00; }
.endpoint_method_patch { background-color: #ef6c00; }
.endpoint_method_delete { background-color: #c62828; }

.endpoint_description {
    margin-top: 8px;
    font-size: 10pt;
    color: #7D7D7D;
    white-space: pre-wrap;
}

/* board history (board_history.html) */

#history_list {
    display: flex;
    flex-direction: column;
    max-width: 800px;
}

.history_entry {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
}

.history_entry + .history_entry {
    border-top: 1px solid #ccc;
}

.history_date {
    font-size: 10pt;
    white-space: nowrap;
}

/* settings: access table + add-user form */

.permissions_table {
    border-collapse: collapse;
    margin-bottom: 24px;
}

.permissions_table th {
    text-align: left;
    font-size: 10pt;
    color: #7D7D7D;
    font-weight: normal;
    padding: 4px 12px 8px 0px;
}

.permissions_table td {
    padding: 4px 12px 4px 0px;
}

#add_user_form label, #add_agent_form label {
    margin-right: 12px;
    font-size: 11pt;
}

#add_user_form input[type='text'], #add_agent_form input[type='text'] {
    margin-right: 12px;
}

.theme_picker {
    margin-right: 16px;
    font-size: 11pt;
}

/* agents (account.html list + board_settings.html "ADD AGENT") */

#agent_list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 500px;
    margin-bottom: 16px;
}

.agent_row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent_name {
    min-width: 120px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 4px;
}

.agent_name:hover {
    color: #7D7D7D;
}

.agent_name_input {
    min-width: 120px;
    font-size: 12pt;
}

.agent_token {
    flex: 1;
    font-size: 10pt;
}

/* forms */

input {
    border: 1px solid black;
    padding: 4px;
}

input:focus { border: none; }

input[type='color'] {
    padding: 0px;
    border: none;
    cursor: pointer;
    height: 24px;
    width: 24px;
    vertical-align: middle;
}

input[type='color']::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type='color']::-webkit-color-swatch {
    border: 1px solid black;
}

button {
    border: 1px solid black;
    font-size: 12pt;
    color: black;
    background-color: white;
    border-radius: 4px;

    margin-top: 4px;
    padding: 4px 12px;
}

button:hover {
    color: white;
    background-color: black;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: black;
        color: white;
    }

    #viewer, .lane {
        background-color: #222;
        color: white;
    }

    .active_sidebar_item {
        background-color: #222;
        color: white;
    }

    .new_board:hover {
        color: white;
    }

    .board_card, .ticket, .endpoint {
        background-color: black;
        color: white;
        border-color: white;
    }

    code {
        background-color: black;
        border-color: #555;
        color: white;
    }

    input {
        border-color: white;
        background-color: black;
        color: white;
    }

    button {
        background-color: black;
        color: white;
        border-color: white;
    }

    button:hover {
        background-color: white;
        color: black;
    }

    .lane_add:hover {
        border-color: white;
        color: white;
    }

    .comment + .comment,
    .add_comment_form,
    .history_entry + .history_entry,
    .comment_body blockquote {
        border-color: #555;
    }

    .comment_body pre {
        background-color: rgba(255, 255, 255, 0.08);
    }
}
