/* Algoscool's theme layers over Django Admin, including its native dark mode. */
:root, html[data-theme="light"] {
  --primary: #5547a7; --secondary: #403381; --accent: #ffe59b;
  --header-bg: #5547a7; --header-color: #fff; --header-branding-color: #ffe59b;
  --header-link-color: #fff; --breadcrumbs-bg: #ede8f8; --breadcrumbs-fg: #655e79;
  --breadcrumbs-link-fg: #5547a7; --link-fg: #5547a7; --link-hover-color: #392b80;
  --body-bg: #f8f6fc; --body-fg: #292343; --body-quiet-color: #655e79;
  --body-loud-color: #292343; --darkened-bg: #f2eef9; --selected-bg: #eee8fa;
  --selected-row: #fff5d6; --hairline-color: #eee8f5; --border-color: #e3dcee;
  --button-bg: #5547a7; --button-hover-bg: #403381; --default-button-bg: #403381;
  --default-button-hover-bg: #302363; --object-tools-bg: #5547a7;
  --object-tools-hover-bg: #403381; --close-button-bg: #655e79;
  --font-family-primary: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --studio-card: #fff; --studio-soft: #f0ebfa; --studio-shadow: 0 3px 0 #ece6f5;
}
html[data-theme="dark"] {
  --primary: #b6a6ff; --secondary: #44377b; --accent: #ffe59b;
  --header-bg: #34295e; --header-color: #fff; --header-branding-color: #ffe59b;
  --header-link-color: #fff; --breadcrumbs-bg: #292338; --breadcrumbs-fg: #d7cfe5;
  --breadcrumbs-link-fg: #d0c3ff; --link-fg: #c6b7ff; --link-hover-color: #e1d9ff;
  --body-bg: #1c1827; --body-fg: #eee8f7; --body-loud-color: #fff;
  --body-quiet-color: #c3b9d4; --darkened-bg: #272133; --selected-bg: #393049;
  --selected-row: #413650; --hairline-color: #3c334c; --border-color: #493d5b;
  --button-bg: #6553b5; --button-hover-bg: #7764cc; --default-button-bg: #6553b5;
  --default-button-hover-bg: #7764cc; --object-tools-bg: #6553b5;
  --object-tools-hover-bg: #7764cc; --studio-card: #272133; --studio-soft: #342a48;
  --studio-shadow: 0 3px 0 #15111e;
}
body { font-size: 14px; line-height: 1.6; }
#header { min-height: 78px; height: auto; padding: 16px 32px; gap: 24px; box-sizing: border-box; }
#branding { float: none; }
#site-name { margin: 0; }
.studio-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.studio-brand img { width: 64px; height: 64px; flex: none; }
#header .studio-brand { color: #fff; font-size: 29px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.studio-brand-dot { color: #ffe59b; }
.studio-brand small { display: block; margin-top: 8px; color: #e9e1ff; font-size: 9px; letter-spacing: 1.6px; font-weight: 600; }
#user-tools { font-size: 12px; line-height: 2; letter-spacing: 0; text-transform: none; }
#user-tools a, #logout-form button { border: 0; }
#user-tools a:hover, #logout-form button:hover { text-decoration: underline; text-underline-offset: 4px; }
div.breadcrumbs { padding: 14px 32px; font-size: 13px; border-bottom: 1px solid var(--border-color); }
#content { padding: 32px; }
h1 { color: var(--body-loud-color); font-size: 28px; font-weight: 750; letter-spacing: -.7px; }
.module { border: 1px solid var(--border-color); border-radius: 16px; background: var(--studio-card); box-shadow: var(--studio-shadow); margin-bottom: 24px; }
.module:not(.calendarbox):not(.clockbox) table { width: 100%; }
.module:not(.calendarbox):not(.clockbox) caption, .module:not(.calendarbox):not(.clockbox) h2, .inline-group h2 { background: var(--studio-soft); color: var(--body-loud-color); padding: 14px 18px; font-size: 14px; font-weight: 700; }
.module:not(.calendarbox):not(.clockbox) caption { border-radius: 15px 15px 0 0; }
.module:not(.calendarbox):not(.clockbox) caption .section { color: var(--body-loud-color); }
.studio-module-description { display: block; margin-top: 3px; font-size: 12px; color: var(--body-quiet-color); font-weight: 400; }
.module:not(.calendarbox):not(.clockbox) td, .module:not(.calendarbox):not(.clockbox) th { padding: 14px 18px; vertical-align: middle; }
.module:not(.calendarbox):not(.clockbox) tbody tr:last-child td, .module:not(.calendarbox):not(.clockbox) tbody tr:last-child th { border-bottom: 0; }
.module a.addlink, .module a.changelink, .module a.viewlink { font-size: 12px; }
#nav-sidebar { background: var(--body-bg); padding: 18px 12px; box-sizing: border-box; }
#nav-sidebar .module { margin-bottom: 16px; box-shadow: none; }
#nav-sidebar caption { text-transform: none; letter-spacing: .2px; font-size: 13px; padding: 10px 12px; }
#nav-sidebar .studio-module-description { display: none; }
#nav-sidebar td, #nav-sidebar th { padding: 10px 12px; font-size: 12px; overflow-wrap: anywhere; }
#nav-sidebar .current-model { background: var(--selected-bg); }
#nav-filter { margin: 0 0 16px; border-radius: 8px; background: var(--studio-card); }
.toggle-nav-sidebar { background: var(--studio-soft); color: var(--link-fg); border-color: var(--border-color); }
.studio-welcome { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 30px; }
.studio-eyebrow { color: var(--link-fg); font-size: 10px; font-weight: 750; letter-spacing: 1.8px; margin: 0 0 10px; }
.studio-welcome h1 { font-size: clamp(25px, 3vw, 36px); margin: 0 0 12px; }
.studio-welcome p:last-child { color: var(--body-quiet-color); margin: 0; }
.studio-site-link { display: inline-flex; white-space: nowrap; border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 16px; background: var(--studio-card); font-weight: 650; }
.studio-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; }
.studio-metric { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border-color); border-radius: 18px; padding: 20px; background: var(--studio-card); box-shadow: var(--studio-shadow); }
.studio-metric > span { color: var(--body-quiet-color); font-size: 12px; font-weight: 600; }
.studio-metric strong { color: var(--body-loud-color); font-size: 34px; line-height: 1.2; }
.studio-metric small { font-size: 11px; }
.studio-metric:nth-child(2) { border-top: 4px solid #9bd9de; padding-top: 17px; }
.studio-metric:first-child { border-top: 4px solid #f2cf6d; padding-top: 17px; }
.studio-metric:nth-child(3) { border-top: 4px solid #b7a5ed; padding-top: 17px; }
.studio-section-heading { font-size: 18px; margin-bottom: 18px; }
.dashboard #content { max-width: 1500px; margin: auto; width: 100%; box-sizing: border-box; }
.dashboard #content.colMS { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; }
.dashboard .studio-welcome { grid-column: 1 / -1; margin-bottom: 6px; }
.dashboard #content-main { width: auto; float: none; min-width: 0; }
.dashboard #content-related { width: auto; margin: 0; float: none; background: transparent; align-self: start; }
.dashboard #content > br.clear { display: none; }
#content-related .module { background: var(--studio-card); }
#content-related h2 { border-radius: 15px 15px 0 0; }
#content-related h3 { font-size: 12px; }
#content-related .actionlist li { padding-block: 8px; font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=tel], select, textarea { border-radius: 8px; border: 1px solid var(--border-color); padding: 9px 11px; background-color: var(--studio-card); color: var(--body-fg); box-sizing: border-box; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link-fg); outline-offset: 2px; }
input[type=checkbox] { accent-color: #5547a7; }
.form-row { padding: 17px 18px; }
.aligned label { font-weight: 650; }
fieldset.module > h2 { border-radius: 15px 15px 0 0; }
.submit-row { border: 1px solid var(--border-color); border-radius: 14px; padding: 16px; background: var(--studio-card); }
.button, input[type=submit], input[type=button], .submit-row input, a.button { border-radius: 9px; padding: 11px 17px; font-weight: 650; }
.object-tools a { border-radius: 9px; padding: 10px 14px; }
#changelist { border-radius: 16px; box-shadow: var(--studio-shadow); border: 1px solid var(--border-color); background: var(--studio-card); }
#changelist .actions, #changelist .paginator, #toolbar { background: var(--studio-card); padding: 14px; }
#changelist #toolbar { border-radius: 16px 16px 0 0; }
#changelist .results { overflow-x: auto; }
#changelist-filter { background: var(--studio-card); border-left: 1px solid var(--border-color); }
#changelist-filter h2 { border-radius: 0; }
#changelist-filter h3 { font-size: 13px; }
ul.messagelist li { border-radius: 9px; margin-bottom: 8px; }
.studio-footer { padding: 12px 32px 24px; font-size: 12px; font-weight: 650; color: var(--body-quiet-color); }
.studio-footer span { margin-left: 14px; font-weight: 400; }
.login { background: var(--body-bg); }
.login #container { width: min(450px, calc(100% - 32px)); margin: 7vh auto; border: 1px solid var(--border-color); border-radius: 22px; overflow: hidden; box-shadow: 0 12px 40px #29234314; }
.login #header { padding: 24px; justify-content: center; }
.login #content { padding: 28px; }
.login #content-main { width: 100%; }
.login .form-row { padding: 8px 0; }
.login .form-row label { font-size: 14px; }
.login .form-row #id_username, .login .form-row #id_password { border-radius: 9px; padding: 12px; }
.login .submit-row { border: 0; background: transparent; padding: 16px 0 0; }
.login .submit-row input { width: 100%; }
.login .studio-footer { padding: 0 28px 24px; text-align: center; }
.login .studio-footer span { display: block; margin: 5px 0 0; }
@media (max-width: 1100px) {
  .dashboard #content.colMS { grid-template-columns: minmax(0, 1fr); }
  .dashboard #content-related { margin-top: 12px; }
}
@media (max-width: 767px) {
  #header { padding: 16px; gap: 12px; flex-direction: column; align-items: center; }
  #user-tools { width: 100%; margin: 0; text-align: center; padding: 0; }
  #header .studio-brand { font-size: 25px; }
  .studio-brand img { width: 52px; height: 52px; }
  #content { padding: 22px 16px; }
  div.breadcrumbs { padding: 12px 16px; }
  .studio-welcome { align-items: flex-start; flex-direction: column; gap: 16px; }
  .studio-metrics { grid-template-columns: minmax(0, 1fr); }
  .studio-metric { padding: 18px; }
  .module:not(.calendarbox):not(.clockbox) td, .module:not(.calendarbox):not(.clockbox) th { padding: 12px; }
  .studio-module-description { font-size: 11px; }
  .studio-footer { padding-inline: 16px; }
}

select:not([multiple]) { height: auto; min-height: 38px; line-height: 1.3; }
/* Long dashboards must grow without squeezing the header's account controls. */
#container { min-height: 100vh; height: auto; }
#header { flex-shrink: 0; }
.people-search{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:20px;background:var(--body-bg);border:1px solid var(--hairline-color);border-radius:14px}.people-search input{min-width:220px;padding:10px}.people-search select{padding:8px}.people-search button{padding:10px 18px;border:0;border-radius:9px;background:#6450ac;color:white;cursor:pointer}.people-results{overflow:auto}.people-results table{width:100%}.people-results td{padding:14px}.people-results small{color:var(--body-quiet-color)}

.timeline-note{border-left:3px solid #9b80c9;margin:22px 0;padding:4px 18px;background:var(--body-bg)}#client-timeline textarea{max-width:95%;width:600px}
.bank-editor-intro{max-width:850px;color:var(--body-quiet-color);line-height:1.6}.bank-editor fieldset{margin-bottom:24px!important}.bank-editor .aligned label{float:none!important;display:block!important;width:auto!important;max-width:none!important;padding:0 0 9px!important;font-size:14px!important}.bank-editor .aligned .form-row>div{display:block!important}.bank-editor .aligned .help,.bank-editor .aligned p.help{margin-left:0!important;padding-left:0!important}.bank-editor input[type=text],.bank-editor textarea{width:100%!important;max-width:950px!important;box-sizing:border-box}.bank-editor .bank-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace!important;font-size:14px!important;line-height:1.6!important}.bank-editor .markdown-toolbar{display:flex;flex-wrap:wrap;gap:7px;margin:10px 0}.bank-editor .markdown-toolbar button{padding:6px 10px;border:1px solid #ddd2ee;border-radius:7px;background:#f7f3fc;color:#624b91}.bank-editor .markdown-preview{padding:18px;border:1px solid #e6dcf1;border-radius:12px;max-width:950px;background:var(--body-bg)}.bank-editor fieldset[hidden]{display:none!important}
.bank-editor .bank-details{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.bank-editor .bank-details>h2,.bank-editor .bank-details>.field-title,.bank-editor .bank-details>.field-published{grid-column:1/-1}.bank-editor .bank-details .form-row{padding:18px!important;min-width:0}.bank-editor .checkbox-row{display:flex!important;align-items:center;gap:8px}.bank-editor .checkbox-row label{display:inline!important;padding:0!important}.bank-editor .markdown-preview img{max-width:100%;height:auto}.bank-editor .markdown-preview pre{overflow:auto}.bank-editor .readonly{overflow-wrap:anywhere}@media(max-width:767px){.bank-editor .bank-details{grid-template-columns:minmax(0,1fr)}.bank-editor input,.bank-editor select,.bank-editor textarea{max-width:100%!important}}
.bank-editor .flex-container:not(.checkbox-row){display:block!important;min-width:0}.bank-editor .readonly{margin-left:0!important;padding-left:0!important}.bank-editor .markdown-source{display:block}.bank-editor .markdown-source[hidden]{display:none!important}
/* Person profiles: identity first, grouped details and readable school records. */
.person-profile{max-width:1200px;margin:0 auto;color:var(--body-fg)}.person-profile *{box-sizing:border-box}.person-hero{display:flex;gap:22px;align-items:center;padding:26px;background:var(--studio-card);border:1px solid var(--border-color);border-radius:16px;margin-bottom:20px}.person-avatar{width:76px;height:76px;object-fit:cover;border-radius:18px;flex-shrink:0}.person-initial{display:flex;align-items:center;justify-content:center;background:var(--studio-soft);color:var(--link-fg);font-size:32px;font-weight:750}.person-heading{min-width:0;flex:1}.person-profile .person-heading h1{font-size:28px;line-height:1.3;margin:4px 0 10px;overflow-wrap:anywhere}.person-eyebrow{text-transform:uppercase;letter-spacing:1px;font-size:10px;font-weight:700;color:var(--body-quiet-color)}.person-heading p{margin:6px 0 10px}.person-badges,.person-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.person-actions{font-size:13px}.person-hero>.person-actions{max-width:240px;justify-content:flex-end}.person-profile .person-button,.person-profile button{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;background:var(--button-bg);color:white;border:0;border-radius:9px;font:inherit;font-size:13px;text-decoration:none;cursor:pointer}.person-profile .person-button:hover,.person-profile button:hover{background:var(--button-hover-bg)}.person-profile .person-disable{background:transparent;border:1px solid var(--border-color);color:var(--body-fg)}.person-badge{display:inline-block;padding:5px 9px;font-size:11px;font-weight:600;line-height:1.4;border-radius:6px;background:var(--studio-soft);color:var(--body-fg)}.person-active{background:#e6f3eb;color:#24633e}.person-disabled{background:#fae8e6;color:#8c3c36}.person-tabs{display:flex;gap:22px;overflow:auto;white-space:nowrap;padding:12px 2px;margin-bottom:20px;border-bottom:1px solid var(--border-color);font-size:13px}.person-profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px}.person-panel{padding:24px;background:var(--studio-card);border:1px solid var(--border-color);border-radius:14px;margin-bottom:20px;min-width:0;scroll-margin-top:20px}.person-profile-grid>.person-panel{margin-bottom:0}.person-profile h2{font-size:19px;margin:0 0 18px;padding:0;color:var(--body-fg);background:none}.person-facts{margin:0}.person-facts>div{display:grid;grid-template-columns:130px minmax(0,1fr);gap:16px;padding:12px 0;border-bottom:1px solid var(--hairline-color)}.person-facts>div:last-child{border:0}.person-facts dt{font-size:12px;color:var(--body-quiet-color)}.person-facts dd{margin:0;font-size:14px;overflow-wrap:anywhere}.person-facts+p,.person-facts+a{display:block;margin-top:14px}.person-muted,.person-section-heading p{color:var(--body-quiet-color);font-size:13px;line-height:1.6}.person-access-action{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:16px}.person-access-action small{color:var(--body-quiet-color);max-width:230px;line-height:1.5}.person-section-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:18px}.person-section-heading h2{margin-bottom:5px}.person-section-heading p{margin:0}.person-count{font-size:12px;padding:3px 8px;background:var(--studio-soft);border-radius:6px;vertical-align:middle}.person-record{display:flex;gap:16px;justify-content:space-between;align-items:center;padding:16px 0;border-top:1px solid var(--hairline-color);font-size:13px}.person-record-title{font-weight:650;font-size:15px}.person-record p{font-size:13px;line-height:1.5;color:var(--body-quiet-color);margin:5px 0 0}.person-record .person-badge{flex-shrink:0}.person-table-wrap{max-width:100%;overflow:auto;margin-top:20px}.person-table-wrap table{width:100%;border-collapse:collapse}.person-table-wrap caption{text-align:left;font-weight:650;font-size:13px;padding:10px 0}.person-table-wrap th{background:var(--studio-soft);padding:12px;font-size:11px;white-space:nowrap}.person-table-wrap td{padding:14px 12px;font-size:13px;vertical-align:middle}.person-note-composer{border:1px solid var(--border-color);border-radius:10px;padding:14px 16px;margin:20px 0}.person-note-composer>summary{cursor:pointer;font-weight:650;font-size:13px}.person-note-fields{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:20px 0}.person-note-field{display:grid;gap:7px;min-width:0}.person-note-field label{font-size:12px}.person-note-field input,.person-note-field select{max-width:100%;width:100%}.person-note-body{grid-column:1/-1}.person-profile #client-timeline textarea{width:100%;max-width:100%;resize:vertical}.person-note-meta{display:flex;gap:12px;flex-wrap:wrap;font-size:13px}.person-note-meta time{color:var(--body-quiet-color)}.person-profile .timeline-note{background:transparent;border-color:var(--primary);padding:6px 18px}.person-profile .timeline-note p{line-height:1.7;overflow-wrap:anywhere}
@media(max-width:800px){.person-hero{align-items:flex-start;flex-wrap:wrap;padding:20px}.person-hero>.person-actions{max-width:none;width:100%;justify-content:flex-start}.person-profile-grid{grid-template-columns:1fr}.person-section-heading{flex-direction:column}.person-panel{padding:20px}.person-profile .person-heading h1{font-size:24px}.person-tabs{gap:18px}.person-facts>div{grid-template-columns:100px minmax(0,1fr)}}
@media(max-width:480px){.person-avatar{width:52px;height:52px;border-radius:12px;font-size:24px}.person-hero{gap:14px}.person-profile .person-heading h1{font-size:22px}.person-facts>div{grid-template-columns:1fr;gap:5px}.person-note-fields{grid-template-columns:1fr}.person-record{flex-wrap:wrap}.person-table-wrap table{min-width:520px}}

/* Dashboard content and recent actions occupy stable columns. Utility links are
   inside the main column, so they cannot push the dashboard into the sidebar. */
.dashboard #content-main{grid-column:1;width:100%;min-width:0}
.dashboard #content-related{grid-column:2;min-width:0}
.dashboard .studio-export-actions{margin:0 0 20px}
.dashboard .studio-metric{min-width:0}
.dashboard .studio-metric span,.dashboard .studio-metric small{overflow-wrap:normal;word-break:normal}
.dashboard #content-main .module table{width:100%;table-layout:auto}
.dashboard #content-main .module td a{white-space:nowrap}
@media(max-width:1100px){.dashboard #content-main,.dashboard #content-related{grid-column:1}.dashboard #content-related{width:100%}}
