.text-sm {
    font-size: 13px;
}

/* Dark-mode-aware colour tokens used throughout this file */
:root {
    --ae-border: #e5e7eb;
    --ae-bg-subtle: #f9fafb;
    --ae-bg-muted: #f3f4f6;
    --ae-bg-row-alt: #ffffff;
    --ae-text-muted: #4b5563;
    --ae-primary: rgb(242 110 33);
    --ae-primary-hover: rgb(245 146 89);
}

.dark {
    --ae-border: #374151;
    --ae-bg-subtle: #1f2937;
    --ae-bg-muted: #1f2937;
    --ae-bg-row-alt: #111827;
    --ae-text-muted: #9ca3af;
    --ae-primary: rgb(245 146 89);
    --ae-primary-hover: rgb(247 171 126);
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: var(--ae-bg-subtle) !important;
}

.admin-action-link {
    border: 1px solid var(--ae-border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-default, 4px);
    font-size: 0.875rem;
    white-space: nowrap;
}

.admin-action-link:hover {
    color: var(--ae-primary);
}

/* Small pill-style secondary action links (e.g. org changelist toolbar) */
.admin-pill-link {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
}

.admin-pill-link:hover {
    background-color: #f3f4f6;
}

.dark .admin-pill-link {
    border-color: #374151;
}

.dark .admin-pill-link:hover {
    background-color: #1f2937;
}

/* Bold form field labels */
label {
    font-weight: 600;
}

/* Recent actions list: colour-code add/change/delete entries with a left border */
.actionlist li.addlink    { border-left: 3px solid #16a34a; }
.actionlist li.changelink { border-left: 3px solid #2563eb; }
.actionlist li.deletelink { border-left: 3px solid #dc2626; }

/* Style datetime split fields (Date/Time inputs) as a two-column label+input grid */
p.datetime {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.5rem;
    align-items: center;
    margin: 0;
}

p.datetime br {
    display: none;
}

/* Align checkbox label with its help text (both use ml-2) */
.vCheckboxLabel {
    margin-left: 0.5rem;
}

/* Align ForeignKey select with its related-object action icons on one row */
.related-widget-wrapper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

/* tab_action.html <li> items render as direct flex children without a <ul> parent */
.flex-row > li {
    list-style: none;
}

textarea,
select,
input[type="number"],
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="tel"] {
    border: 1px solid var(--ae-border);
    border-radius: var(--radius-default, 4px);
    padding: 0.5rem 0.75rem;
}

#toolbar input[type="text"],
#searchbar {
    border: none !important;
}

table[id*="schemafield_set"] select {
    min-width: 160px !important;
    width: auto !important;
}

/* Readonly field tables (e.g. pandas DataFrames, auditlog changes) */
.readonly table,
.readonly table.dataframe {
    border-collapse: collapse;
    width: 100%;
    margin-top: 4px;
    border: 1px solid var(--ae-border);
}

.readonly table th,
.readonly table td {
    padding: 4px 10px;
    border: 1px solid var(--ae-border);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.readonly table th {
    background-color: var(--ae-bg-muted);
    font-weight: 600;
}

.readonly table tr:nth-child(odd) td {
    background-color: var(--ae-bg-subtle);
}

.readonly table tr:nth-child(even) td {
    background-color: var(--ae-bg-row-alt);
}

/* Definition lists (e.g. waffle flag help text) */
.readonly dl,
.leading-relaxed dl {
    display: grid;
    grid-template-columns: minmax(200px, max-content) 1fr;
    gap: 0;
    margin-top: 4px;
    border: 1px solid var(--ae-border);
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.readonly dl dt,
.readonly dl dd,
.leading-relaxed dl dt,
.leading-relaxed dl dd {
    padding: 5px 12px;
    border-bottom: 1px solid var(--ae-border);
    margin: 0;
    vertical-align: top;
    align-content: center;
}

.readonly dl dt:last-of-type,
.readonly dl dd:last-of-type,
.leading-relaxed dl dt:last-of-type,
.leading-relaxed dl dd:last-of-type {
    border-bottom: none;
}

.readonly dl dt,
.leading-relaxed dl dt {
    background-color: var(--ae-bg-muted);
    font-weight: 900;
    font-family: monospace;
    white-space: nowrap;
    border-right: 1px solid var(--ae-border);
}

.readonly dl dd,
.leading-relaxed dl dd {
    color: var(--ae-text-muted);
}

.readonly dl dt:nth-child(4n+1),
.readonly dl dd:nth-child(4n+2),
.leading-relaxed dl dt:nth-child(4n+1),
.leading-relaxed dl dd:nth-child(4n+2) {
    background-color: var(--ae-bg-subtle);
}

.readonly dl dt:nth-child(4n+3),
.readonly dl dd:nth-child(4n+4),
.leading-relaxed dl dt:nth-child(4n+3),
.leading-relaxed dl dd:nth-child(4n+4) {
    background-color: var(--ae-bg-row-alt);
}


/* Style Django's historylink to match Unfold actions_detail pill buttons */
.object-tools li:has(> a.historylink) {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--ae-border);
    border-radius: var(--radius-default, 4px);
    margin-left: -1px;
}

a.historylink {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    font-size: 0.875rem;
}

a.historylink:hover {
    color: var(--ae-primary);
}

/* Django history table (#change-history) */
#change-history {
    border-collapse: collapse;
    width: 100%;
    margin-top: 0.5rem;
    border: 1px solid var(--ae-border);
    border-radius: var(--radius-default, 4px);
    overflow: hidden;
}

#change-history th,
#change-history td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--ae-border);
    border-right: 1px solid var(--ae-border);
    text-align: left;
    font-size: 0.875rem;
}

#change-history th:last-child,
#change-history td:last-child {
    border-right: none;
}

#change-history thead th {
    background-color: var(--ae-bg-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ae-text-muted);
}

#change-history tbody tr:last-child th,
#change-history tbody tr:last-child td {
    border-bottom: none;
}

#change-history tbody tr:nth-child(odd) {
    background-color: var(--ae-bg-subtle);
}

#change-history tbody tr:nth-child(even) {
    background-color: var(--ae-bg-row-alt);
}

#change-history tbody tr:hover {
    background-color: var(--ae-bg-muted);
}

/* FixtureConfiguration sync_pipelines widget */
.sync-pipelines-widget > div {
    float: left;
    width: 33%;
}
.sync-pipelines-widget > div > label {
    font-weight: bold;
}
.sync-pipelines-widget label {
    width: 100%;
}
