/* ========================================
   Break Tracker - CSS Styles
   Paper Cutout Theme (matching Daily Champion)
   ======================================== */

/* Ensure hidden attribute works */
[hidden] {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* CSS Variables - Paper Cutout Theme */
:root {
    --primary-color: #E17055;
    --primary-dark: #D35E45;
    --primary-light: #F08A74;
    --secondary-color: #27AE60;
    --danger-color: #E74C3C;
    --warning-color: #F39C12;
    --success-color: #27AE60;
    
    /* Break-specific colors */
    --toilet-color: #C2643F;
    --toilet-hover: #AE5432;
    --drink-color: #06B6D4;
    --drink-hover: #0891B2;
    
    /* Paper Cutout Colors */
    --paper-bg: #FAFAF8;
    --paper-card: var(--cs-color-surface, #FFFFFF);
    --paper-outline: #2D3436;
    --paper-shadow: #D0D0D0;
    --paper-accent-yellow: #FFEAA7;
    --paper-accent-pink: #FFD6D6;
    --paper-accent-green: #D4EDDA;
    --paper-accent-blue: #D6E9FF;
    --paper-accent-purple: #F8E1D6;
    --paper-accent-cyan: #CFFAFE;
    
    --bg-primary: var(--paper-bg);
    --bg-secondary: var(--paper-card);
    --bg-tertiary: #F0F0F0;
    --bg-card: var(--paper-card);
    
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-muted: #95A5A6;
    
    --border-color: var(--paper-outline);
    --border-radius: 14px;
    --border-radius-lg: 20px;
    --border-radius-sm: 10px;
    
    --shadow-sm: 2px 2px 0 var(--paper-shadow);
    --shadow-md: 3px 3px 0 var(--paper-shadow);
    --shadow-lg: 4px 4px 0 var(--paper-shadow);
    
    --header-height: 60px;
    --font-family: 'Inter', 'Fredoka', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   Header - Paper Cutout Style
   ======================================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 16px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    margin: 12px;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 22px;
    font-weight: 300;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    position: relative;
    left: 0;
}

.app-header h1 .accent {
    font-weight: 700;
    color: var(--primary-color, #E17055);
}

.back-btn {
    display: none;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 var(--paper-shadow);
    background: var(--paper-accent-yellow);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.dashboard-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.dashboard-link-btn:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 var(--paper-shadow);
    background: var(--paper-accent-blue);
    color: var(--text-primary);
}

.dashboard-link-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Buttons - Paper Cutout Style
   ======================================== */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.btn-ghost:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 var(--paper-shadow);
    background: var(--paper-accent-yellow);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--primary-color);
    border: 2px solid var(--paper-outline);
    color: white;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 var(--paper-shadow);
}

.btn-primary:disabled,
.btn-ghost:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled:hover,
.btn-ghost:disabled:hover {
    background: var(--primary-color);
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn-ghost:disabled:hover {
    background: var(--paper-card);
}

/* ========================================
   Screens
   ======================================== */
.screen {
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ========================================
   Class Selection Screen
   ======================================== */
.selection-container {
    max-width: 600px;
    margin: 1rem auto;
    text-align: center;
}

.selection-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.class-section {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}

.class-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: left;
}

.class-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}

.class-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.class-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--paper-shadow);
    background: var(--paper-accent-yellow);
}

.class-item-name {
    font-weight: 600;
    color: var(--text-primary);
}

.class-item-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.class-item-actions {
    display: flex;
    gap: 0.5rem;
}

.class-item-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.create-class-btn {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
}

.manage-classes-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
    margin-top: 0.5rem;
}

.manage-classes-hint a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.manage-classes-hint a:hover {
    text-decoration: underline;
}

.no-classes-message {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
}

.class-list-status {
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem;
}

/* ========================================
   Student Grid Screen
   ======================================== */
.class-header {
    margin-bottom: 1rem;
}

.class-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.current-class-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.current-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.time-period-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    border: 2px solid var(--paper-outline);
    box-shadow: var(--shadow-sm);
}

.time-period-badge.morning {
    background: var(--paper-accent-yellow);
    color: var(--text-primary);
}

.time-period-badge.afternoon {
    background: var(--paper-accent-blue);
    color: var(--text-primary);
}

.shared-toilet-status-pill {
    position: relative;
}

.shared-toilet-status-pill summary {
    align-items: center;
    background: var(--paper-accent-blue);
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.8rem;
    gap: 6px;
    font-weight: 700;
    line-height: 1;
    list-style: none;
    padding: 6px 12px;
    white-space: nowrap;
}

.shared-toilet-status-pill summary::-webkit-details-marker {
    display: none;
}

.shared-toilet-status-pill summary::after {
    content: '▾';
    font-size: 0.65rem;
}

.shared-toilet-status-pill[open] summary {
    background: var(--paper-accent-yellow);
}

.shared-toilet-status-label {
    color: var(--text-secondary);
}

.shared-toilet-status-summary {
    color: var(--text-primary);
}

.shared-toilet-status-popover {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    display: grid;
    gap: 8px;
    left: 0;
    min-width: min(420px, calc(100vw - 32px));
    padding: 10px;
    position: absolute;
    top: calc(100% + 8px);
    z-index: 50;
}

.shared-toilet-status-controls {
    align-items: center;
    display: grid;
    gap: 6px;
    grid-template-columns: auto minmax(150px, 1fr);
}

.shared-toilet-status-controls label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 800;
}

.shared-toilet-status-controls select {
    min-height: 34px;
    padding: 6px 28px 6px 10px;
}

.shared-toilet-status-list {
    display: grid;
    gap: 8px;
}

.shared-toilet-status-item {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 0;
    padding: 8px 10px;
}

.shared-toilet-status-item strong {
    font-size: 0.85rem;
}

.shared-toilet-status-item span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: right;
}

.shared-toilet-status-item.is-available {
    background: var(--paper-accent-green);
}

.shared-toilet-status-item.is-in-use {
    background: #FFF3CD;
}

.shared-toilet-status-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.tracker-view-tabs {
    align-items: center;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    gap: 4px;
    padding: 3px;
}

.tracker-view-tab {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 800;
    gap: 7px;
    min-height: 30px;
    padding: 5px 11px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.tracker-view-tab:hover,
.tracker-view-tab:focus-visible {
    background: var(--paper-accent-yellow);
    color: var(--text-primary);
    outline: none;
}

.tracker-view-tab.is-active {
    background: var(--paper-accent-blue);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 2px var(--paper-outline);
}

.tracker-tab-count {
    align-items: center;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    color: var(--text-primary);
    display: inline-flex;
    font-size: 0.72rem;
    justify-content: center;
    min-width: 24px;
    padding: 1px 6px;
}

.tracker-tab-count.has-active-out {
    background: #FFF3CD;
    color: #7A5300;
}

.tracker-view-panel {
    margin-top: 1rem;
}

/* ========================================
   Today's Activity Log Panel
   ======================================== */
.daily-summary-panel {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 14px;
}

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

.daily-summary-header h2 {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.2;
    margin: 0;
}

.summary-count {
    background: var(--paper-accent-blue);
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 10px;
}

.daily-summary-content {
    column-count: 2;
    column-gap: 14px;
}

.summary-group {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    break-inside: avoid;
    box-shadow: var(--shadow-sm);
    display: inline-block;
    margin: 0 0 14px;
    overflow: hidden;
    width: 100%;
}

.summary-group--empty {
    align-self: stretch;
}

.summary-group--dense {
    column-span: all;
    display: block;
}

.summary-group-header {
    align-items: center;
    background: var(--paper-accent-green);
    border-bottom: 2px solid var(--paper-outline);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 9px 12px;
}

.summary-group-header h3 {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.2;
    margin: 0;
}

.summary-group-time {
    color: var(--text-secondary);
    display: block;
    font-size: 0.74rem;
    font-weight: 800;
    margin-top: 2px;
}

.summary-group-total {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 9px;
    white-space: nowrap;
}

.summary-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.summary-table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.summary-table th,
.summary-table td {
    border-bottom: 1px solid #D9DEE0;
    padding: 9px 12px;
    text-align: left;
    vertical-align: middle;
}

.summary-table tr:last-child td {
    border-bottom: 0;
}

.summary-table th {
    background: #F6F7F7;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-table th:nth-child(2),
.summary-table th:nth-child(3),
.summary-table td:nth-child(2),
.summary-table td:nth-child(3) {
    text-align: center;
    width: 96px;
}

.summary-table-name {
    color: var(--text-primary);
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 800;
    margin-right: 8px;
    overflow-wrap: anywhere;
}

.summary-table-count {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 900;
}

.summary-dense-grid {
    display: grid;
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 12px 10px;
}

.summary-dense-row {
    align-items: center;
    border-bottom: 1px solid #D9DEE0;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) 52px 52px;
    min-height: 40px;
    padding: 8px 0;
}

.summary-dense-heading {
    align-items: center;
    color: var(--text-secondary);
    display: grid;
    font-size: 0.7rem;
    font-weight: 900;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) 52px 52px;
    padding: 9px 0 7px;
    text-transform: uppercase;
}

.summary-dense-heading span:nth-child(2),
.summary-dense-heading span:nth-child(3) {
    text-align: center;
}

.summary-dense-row:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.summary-dense-row .summary-table-name {
    font-size: 0.86rem;
}

.summary-dense-row .summary-table-count {
    text-align: center;
}

.summary-table-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center !important;
}

.summary-empty-block {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    padding: 10px 12px;
    text-align: center;
}

.summary-group--empty .summary-group-header {
    min-height: 74px;
}

.summary-out-status {
    align-items: center;
    background: #FFF3CD;
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    color: #7A5300;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    min-height: 24px;
    padding: 3px 8px;
    white-space: nowrap;
}

.today-log-panel {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
}

.today-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
}

.today-log-header::-webkit-details-marker {
    display: none;
}

.today-log-header::before {
    content: '▶';
    font-size: 0.7rem;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.today-log-panel[open] .today-log-header::before {
    transform: rotate(90deg);
}

.log-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--paper-accent-yellow);
    border: 2px solid var(--paper-outline);
    padding: 2px 10px;
    border-radius: 20px;
}

.today-log-content {
    padding: 0 16px 16px;
    max-height: 200px;
    overflow-y: auto;
}

.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.log-entry-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.log-entry-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
    min-width: 50px;
}

.log-entry-name {
    font-weight: 600;
}

.log-entry-type {
    font-size: 0.85rem;
}

.log-entry-location,
.log-entry-returned,
.log-entry-out {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.log-entry-location {
    background: var(--paper-accent-pink);
    color: var(--text-primary);
}

.log-entry-returned {
    background: var(--paper-accent-green);
    color: #17603A;
}

.log-entry-out {
    background: #FFF3CD;
    color: #7A5300;
}

.log-entry-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-entry-return {
    background: var(--paper-accent-green);
    border: 2px solid var(--paper-outline);
    color: #17603A;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s;
}

.log-entry-return:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 var(--paper-shadow);
}

.log-entry-delete {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9rem;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.15s;
}

.log-entry-delete:hover {
    color: white;
    background: var(--danger-color);
}

.no-log-message {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.student-card {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    box-shadow: var(--shadow-md);
}

.student-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--paper-shadow);
}

.student-card:active {
    transform: translate(0, 0);
    box-shadow: var(--shadow-md);
}

.student-card-out {
    border-color: #F39C12;
    background: #FFF8E8;
}

/* Card flash animations for success feedback */
.student-card.flash-toilet {
    animation: flashToilet 0.6s ease-out;
}

.student-card.flash-drink {
    animation: flashDrink 0.6s ease-out;
}

@keyframes flashToilet {
    0% { background: var(--paper-card); }
    30% { background: var(--paper-accent-purple); border-color: var(--toilet-color); box-shadow: 0 0 20px rgba(194, 100, 63, 0.38); }
    100% { background: var(--paper-card); }
}

@keyframes flashDrink {
    0% { background: var(--paper-card); }
    30% { background: var(--paper-accent-cyan); border-color: var(--drink-color); box-shadow: 0 0 20px rgba(6, 182, 212, 0.4); }
    100% { background: var(--paper-card); }
}

.student-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-word;
}

.student-stats {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 0.85rem;
}

.stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.stat-toilet {
    color: var(--toilet-color);
    background: var(--paper-accent-purple);
}

.stat-drink {
    color: var(--drink-color);
    background: var(--paper-accent-cyan);
}

.stat-out {
    color: #7A5300;
    background: #FFF3CD;
}

/* ========================================
   Break Type Modal
   ======================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    max-width: 90%;
    width: 400px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.break-modal {
    text-align: center;
    width: 340px;
}

.break-modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.break-prompt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.break-options {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.break-options.single-option .break-btn {
    max-width: 220px;
    margin: 0 auto;
}

.break-btn {
    flex: 1;
    padding: 20px 16px;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.break-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--paper-shadow);
}

.break-btn:active {
    transform: translate(0, 0);
    box-shadow: var(--shadow-md);
}

.toilet-btn {
    background: var(--toilet-color);
    color: white;
}

.toilet-btn:hover {
    background: var(--toilet-hover);
}

.drink-btn {
    background: var(--drink-color);
    color: white;
}

.drink-btn:hover {
    background: var(--drink-hover);
}

.break-icon {
    font-size: 2rem;
}

.break-label {
    font-size: 1rem;
    font-weight: 700;
}

.cancel-btn {
    width: 100%;
    margin-top: 8px;
}

.toilet-location-modal {
    width: min(640px, calc(100vw - 32px));
    text-align: left;
}

.toilet-location-modal h3 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.toilet-location-modal .break-prompt {
    margin-bottom: 1rem;
}

.toilet-location-picker {
    margin-top: 14px;
}

.toilet-location-picker-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.toilet-location-picker-header > span:first-child {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 800;
}

.toilet-location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    max-height: min(46vh, 360px);
    overflow-y: auto;
    padding: 2px 4px 4px 2px;
    scrollbar-gutter: stable;
}

.toilet-location-grid:focus {
    outline: none;
}

.toilet-location-option {
    min-height: 96px;
    padding: 14px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
    box-shadow: var(--shadow-md);
}

.toilet-location-option:not(:disabled):hover,
.toilet-location-option:not(:disabled):focus-visible {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--paper-shadow);
}

.toilet-location-option:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.toilet-location-option.is-selected {
    background: var(--paper-accent-blue);
    border-color: #2563EB;
}

.toilet-location-option.is-in-use {
    background: #F3F4F6;
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: var(--shadow-sm);
}

.toilet-location-option-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.toilet-location-name {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.toilet-location-status {
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
    white-space: nowrap;
}

.toilet-location-option.is-available .toilet-location-status {
    color: #1F7A45;
}

.toilet-location-option.is-in-use .toilet-location-status {
    color: #92400E;
}

.toilet-location-detail {
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.toilet-location-option.is-selected .toilet-location-detail {
    color: #1D4ED8;
}

.toilet-location-hint {
    flex: 1 1 auto;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
}

.toilet-location-hint.is-ready {
    color: #1F7A45;
}

.toilet-location-hint.is-warning {
    color: #92400E;
}

.return-confirm-modal {
    width: 360px;
    text-align: center;
}

.return-confirm-actions {
    justify-content: center;
}

/* ========================================
   Create Class Modal
   ======================================== */
.create-class-modal {
    width: 450px;
}

.create-class-modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.text-input,
.textarea-input,
.select-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--paper-card);
    color: var(--text-primary);
    transition: all 0.15s;
}

.text-input:focus,
.textarea-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(225, 112, 85, 0.2);
}

.textarea-input {
    resize: vertical;
    min-height: 150px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* ========================================
   History Screen
   ======================================== */
.history-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 1rem;
}

.history-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.history-controls {
    display: grid;
    grid-template-columns: minmax(155px, 1fr) minmax(155px, 1fr) minmax(240px, 2fr);
    align-items: end;
    gap: 12px;
    margin-bottom: 1rem;
}

.history-controls label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.history-filter-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.history-search-field {
    grid-column: auto;
}

.history-controls .select-input,
.history-controls input.select-input {
    width: 100%;
    min-width: 0;
}

.history-reset-btn {
    min-height: 42px;
    justify-content: center;
}

.history-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
}

.history-advanced-filters {
    grid-column: 1 / -1;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: #ffffff;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
}

.history-advanced-filters summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 10px;
    font-weight: 800;
    justify-content: space-between;
}

.history-advanced-summary {
    background: var(--paper-accent-blue);
    border: 1px solid #b9cfe5;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.2;
    max-width: min(70%, 560px);
    overflow-wrap: anywhere;
    padding: 4px 8px;
    text-align: right;
}

.history-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.history-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.history-day {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.history-empty-state {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    display: grid;
    gap: 4px;
    padding: 18px;
}

.history-empty-state strong {
    color: var(--text-primary);
    font-size: 1.05rem;
}

.history-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
    gap: 12px;
    align-items: stretch;
    min-width: 0;
}

.history-overview-main,
.history-repeat-panel {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.history-overview-main {
    background: #ffffff;
    padding: 16px 18px;
}

.history-eyebrow,
.history-repeat-panel span,
.history-section-heading span,
.history-summary-card span {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 800;
}

.history-eyebrow,
.history-section-heading span {
    text-transform: uppercase;
}

.history-overview-main h3 {
    color: var(--text-primary);
    font-size: 1.45rem;
    line-height: 1.1;
    margin: 4px 0;
}

.history-overview-main p {
    color: var(--text-secondary);
    font-weight: 700;
    margin: 0;
}

.history-repeat-panel {
    background: var(--paper-accent-blue);
    display: grid;
    gap: 4px;
    align-content: center;
    padding: 14px 16px;
}

.history-repeat-panel.quiet {
    background: #ffffff;
}

.history-repeat-panel strong {
    color: var(--text-primary);
    font-size: 1.05rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.history-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    min-width: 0;
}

.history-summary-card {
    min-height: 82px;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    padding: 12px;
    display: grid;
    align-content: center;
    gap: 7px;
}

.history-summary-card strong {
    color: var(--text-primary);
    font-size: 1.55rem;
    line-height: 1;
    overflow-wrap: anywhere;
}

.history-summary-card.toilet strong {
    color: var(--toilet-color);
}

.history-summary-card.drink strong {
    color: var(--drink-color);
}

.history-summary-card.warning {
    background: var(--paper-accent-pink);
}

.history-summary-card.wide {
    grid-column: span 1;
}

.history-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.history-breakdown-card,
.history-log-section {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    padding: 14px;
    min-width: 0;
}

.history-section-heading {
    display: grid;
    gap: 2px;
    margin-bottom: 10px;
}

.history-section-heading h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
}

.history-section-heading p {
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
    margin: 0;
}

.history-mini-list {
    display: grid;
    gap: 8px;
}

.history-mini-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 2px solid #d8dde3;
    border-radius: var(--border-radius-sm);
    background: #fbfbf9;
    padding: 9px 10px;
}

.history-mini-row strong,
.history-mini-row span {
    min-width: 0;
}

.history-mini-row strong {
    overflow-wrap: anywhere;
}

.history-mini-row span {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
}

.history-pupil-row {
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
}

.history-pupil-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    min-width: 0;
}

.history-pupil-metrics span {
    background: #ffffff;
    border: 1px solid #d8dde3;
    border-radius: 999px;
    line-height: 1.2;
    padding: 4px 7px;
    text-align: center;
    white-space: normal;
}

.history-mini-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.history-entry-cards {
    display: none;
}

.history-entry-card {
    border: 2px solid #d8dde3;
    border-radius: var(--border-radius-sm);
    background: #fbfbf9;
    display: grid;
    gap: 9px;
    padding: 10px;
}

.history-entry-card-top,
.history-entry-card-status {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.history-entry-card-top strong {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.history-entry-card-top span,
.history-entry-card-status > span:last-child {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
}

.history-entry-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-entry-card-meta span {
    background: #ffffff;
    border: 1px solid #d8dde3;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 4px 7px;
}

.history-table-wrap {
    overflow-x: auto;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: #ffffff;
    max-width: 100%;
    min-width: 0;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px dashed #E0E0E0;
}

.history-table th {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    background: var(--paper-accent-yellow);
    white-space: nowrap;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.type-toilet {
    color: var(--toilet-color);
    font-weight: 600;
}

.type-drink {
    color: var(--drink-color);
    font-weight: 600;
}

.history-status-chip {
    display: inline-flex;
    align-items: center;
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    padding: 4px 8px;
    background: #ffffff;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.history-status-chip.out {
    background: var(--paper-accent-yellow);
}

.history-status-chip.returned {
    background: var(--paper-accent-green);
}

.history-status-chip.not_tracked {
    background: #f1f3f5;
}

.history-duration-warning {
    color: var(--danger-color);
    font-weight: 800;
}

.history-load-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    border: 2px dashed var(--paper-outline);
    border-radius: var(--border-radius-sm);
    padding: 10px 12px;
    background: #ffffff;
}

.history-load-more span {
    color: var(--text-secondary);
    font-weight: 700;
}

/* ========================================
   Print Modal
   ======================================== */
.print-modal {
    width: 400px;
}

.print-modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

/* ========================================
   Print Preview
   ======================================== */
.print-preview {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-primary);
    overflow: auto;
}

.print-preview-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    margin: 12px;
    box-shadow: var(--shadow-md);
}

.print-preview-content {
    max-width: 800px;
    margin: 16px auto;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.print-report-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--paper-outline);
}

.print-report-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.print-report-header p {
    color: var(--text-secondary);
}

.print-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.summary-card .value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.summary-card .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.summary-card.toilet .value {
    color: var(--toilet-color);
}

.summary-card.drink .value {
    color: var(--drink-color);
}

.summary-card.returned .value {
    color: #17603A;
}

.summary-card.out .value {
    color: #A15D00;
}

.print-section {
    margin-bottom: 20px;
}

.print-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* ========================================
   Toast Notification
   ======================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--paper-outline);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--paper-outline);
}

.toast-undo-btn {
    background: var(--primary-color);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toast-undo-btn:hover {
    background: #d45a3c;
    transform: translateY(-1px);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast.hiding {
    animation: toastOut 0.3s ease-out forwards;
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    body {
        background: white;
    }

    .print-preview-header {
        display: none;
    }

    .print-preview-content {
        margin: 0;
        padding: 0;
        box-shadow: none;
        max-width: 100%;
    }

    .print-report-header {
        margin-bottom: 1rem;
    }
}

/* ========================================
   Export Modal
   ======================================== */
.export-modal {
    width: 400px;
}

.export-modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.export-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.export-fields-group {
    margin-bottom: 6px;
}

.export-fields-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.export-fields-header label {
    margin-bottom: 0;
}

.export-fields-actions {
    display: inline-flex;
    gap: 6px;
}

.export-fields-actions .btn-ghost {
    padding: 5px 8px;
    font-size: 0.78rem;
}

.export-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    background: var(--paper-bg);
}

.export-fields-grid .checkbox-row {
    font-size: 0.84rem;
    font-weight: 600;
}

/* ========================================
   Settings Modal
   ======================================== */
.settings-modal {
    max-height: calc(100vh - 32px);
    max-width: calc(100vw - 32px);
    overflow-y: auto;
    width: min(720px, calc(100vw - 32px));
}

.settings-modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.school-link-status {
    font-size: 0.82rem;
    margin-bottom: 14px;
    padding: 8px 10px;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: var(--paper-bg);
    color: var(--text-secondary);
}

.school-link-status.is-linked {
    background: var(--paper-accent-green);
    color: #166534;
}

.school-link-status.is-disabled {
    background: #FFF4E5;
    color: #9A3412;
}

.school-link-status.is-pending {
    background: var(--paper-accent-blue);
    color: #1E3A8A;
}

.shared-toilets-controls {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: var(--paper-bg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shared-toilets-status {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.shared-toilets-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shared-toilets-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.shared-toilets-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shared-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--paper-card);
}

.shared-toilets-actions {
    display: flex;
    gap: 8px;
}

.shared-toilets-pending {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.shared-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    background: var(--paper-card);
    font-size: 0.78rem;
}

.shared-request-item .btn-primary {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-timeframes {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 10px;
    padding: 12px;
}

.settings-timeframes-header {
    align-items: center;
    color: var(--text-primary);
    display: flex;
    font-size: 0.9rem;
    font-weight: 800;
    gap: 10px;
    justify-content: space-between;
    min-width: 0;
}

.settings-timeframes-header .btn-ghost {
    font-size: 0.78rem;
    padding: 6px 9px;
}

.settings-timeframes-grid {
    display: grid;
    gap: 10px;
}

.summary-timeframe-row {
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(180px, 1fr) minmax(250px, auto) auto;
    padding: 10px;
}

.summary-timeframe-name-field {
    min-width: 0;
}

.summary-timeframe-field {
    display: grid;
    gap: 6px;
}

.summary-timeframe-field label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
}

.summary-timeframe-inputs {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr);
    min-width: 0;
}

.summary-timeframe-inputs .text-input {
    min-width: 0;
    padding: 8px 10px;
}

.summary-timeframe-inputs span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    padding-top: 24px;
}

.summary-timeframe-remove {
    align-self: end;
    font-size: 0.78rem;
    justify-content: center;
    padding: 8px 10px;
    white-space: nowrap;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

#settingToiletLocations {
    min-height: 90px;
}

#settingToiletLocations:disabled {
    opacity: 0.6;
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

/* ========================================
   Auth UI Styles
   ======================================== */
.auth-btn {
    position: relative;
}

.auth-btn.logged-in {
    color: var(--secondary-color);
}

.auth-btn.logged-in::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
    border-radius: 50%;
    border: 2px solid var(--paper-card);
}

.auth-dropdown {
    position: fixed;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 200px;
    padding: 12px;
}

.auth-dropdown.hidden {
    display: none;
}

.auth-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-user-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.auth-school-link {
    font-size: 0.76rem;
    padding: 2px 0 6px;
    line-height: 1.35;
}

.auth-school-link.is-linked {
    color: #166534;
}

.auth-school-link.is-muted {
    color: var(--text-secondary);
}

.auth-prompt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 4px;
}

.auth-modal-content {
    width: min(420px, calc(100vw - 32px));
    max-width: none;
    padding: 32px;
}

.auth-modal-content h3 {
    margin-bottom: 24px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.auth-modal-content .close-modal {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: var(--paper-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    transition: all 0.15s;
}

.auth-modal-content .close-modal:hover,
.auth-modal-content .close-modal:focus-visible {
    outline: none;
    background: var(--paper-accent-pink);
    transform: translateY(-1px);
    box-shadow: 3px 3px 0 var(--paper-shadow);
}

.auth-modal-content form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-modal-content .form-group {
    margin-bottom: 0;
}

.auth-modal-content .form-group label {
    font-size: 0.9rem;
    font-weight: 700;
}

.auth-modal-content input[type="email"],
.auth-modal-content input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    background: var(--paper-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: all 0.15s;
}

.auth-modal-content input[type="email"]:focus,
.auth-modal-content input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(225, 112, 85, 0.2), var(--shadow-sm);
}

.auth-modal-content .btn-primary {
    min-height: 46px;
    font-size: 1rem;
}

.auth-error {
    background: #FEE2E2;
    color: #DC2626;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.auth-success {
    background: #D1FAE5;
    color: #059669;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.auth-local-notice {
    background: #FFF7ED;
    color: #92400E;
    border: 2px solid #FDBA74;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.auth-local-config {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    margin-bottom: 14px;
    background: #FFFBEB;
    border: 2px dashed #D97706;
    border-radius: var(--border-radius-sm);
    color: #78350F;
    font-size: 0.84rem;
    line-height: 1.4;
}

.auth-local-config label {
    font-weight: 700;
    color: #78350F;
}

.auth-local-key-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.auth-local-key-row .text-input {
    min-width: 0;
}

.auth-live-link {
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.auth-live-link:hover {
    text-decoration: underline;
}

.auth-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    text-align: center;
}

.auth-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px 4px;
    font-family: var(--font-family);
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-info {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 2px solid var(--paper-outline);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-captcha-block {
    margin: 2px 0 0;
}

.auth-turnstile-widget {
    min-height: 66px;
    display: flex;
    align-items: center;
}

.auth-captcha-hint {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.full-width {
    width: 100%;
}

.login-prompt {
    text-align: center;
    padding: 32px 20px;
    background: var(--paper-accent-blue);
    border: 2px dashed var(--paper-outline);
    border-radius: var(--border-radius);
}

.login-prompt p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.login-prompt .btn-primary {
    margin-top: 8px;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 640px) {
    .app-header {
        height: 52px;
        margin: 10px;
        padding: 0 10px;
    }

    .app-header h1 {
        flex: 0 0 auto;
        font-size: 1rem;
        margin-right: 8px;
        white-space: nowrap;
    }

    .header-actions {
        gap: 5px;
    }

    .icon-btn {
        height: 32px;
        width: 32px;
    }

    .icon-btn svg {
        height: 18px;
        width: 18px;
    }

    .student-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .student-card {
        padding: 12px;
    }

    .student-name {
        font-size: 0.85rem;
    }

    .daily-summary-header {
        align-items: stretch;
        flex-direction: column;
    }

    .summary-count {
        text-align: center;
        width: 100%;
    }

    .daily-summary-content {
        column-count: 1;
    }

    .summary-group--dense {
        column-span: none;
    }

    .summary-dense-grid {
        grid-template-columns: 1fr;
    }

    .summary-dense-heading:nth-child(2) {
        display: none;
    }

    .summary-dense-row:nth-last-child(-n + 2) {
        border-bottom: 1px solid #D9DEE0;
    }

    .summary-dense-row:last-child {
        border-bottom: 0;
    }

    .summary-group-header {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .summary-group-total {
        justify-self: start;
    }

    .summary-table th,
    .summary-table td {
        padding: 8px 9px;
    }

    .summary-table th:nth-child(2),
    .summary-table th:nth-child(3),
    .summary-table td:nth-child(2),
    .summary-table td:nth-child(3) {
        width: 74px;
    }

    .summary-out-status {
        justify-content: flex-start;
    }

    .settings-timeframes-header,
    .summary-timeframe-row {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .settings-timeframes-header {
        flex-direction: column;
    }

    .settings-timeframes-header .btn-ghost,
    .summary-timeframe-remove {
        width: 100%;
    }

    .shared-toilet-status-pill {
        width: 100%;
    }

    .tracker-view-tabs {
        width: 100%;
    }

    .tracker-view-tab {
        flex: 1;
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    .shared-toilet-status-pill summary {
        justify-content: center;
        width: 100%;
    }

    .shared-toilet-status-popover {
        left: 0;
        min-width: 100%;
    }

    .break-options {
        flex-direction: column;
    }

    .toilet-location-modal {
        width: calc(100vw - 24px);
        padding: 20px;
    }

    .toilet-location-picker-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .toilet-location-hint {
        text-align: left;
    }

    .toilet-location-grid {
        grid-template-columns: 1fr;
        max-height: 48vh;
    }

    .history-controls {
        grid-template-columns: 1fr;
    }

    .history-search-field {
        grid-column: span 1;
    }

    .history-summary-card.wide {
        grid-column: 1 / -1;
    }

    .history-overview,
    .history-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .history-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .history-summary-card {
        min-height: 74px;
        padding: 10px;
    }

    .history-summary-card strong {
        font-size: 1.35rem;
    }

    .history-inline-actions,
    .history-load-more {
        align-items: stretch;
        flex-direction: column;
    }

    .history-advanced-grid {
        grid-template-columns: 1fr;
    }

    .history-mini-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-pupil-row {
        grid-template-columns: 1fr;
    }

    .history-pupil-metrics {
        justify-content: flex-start;
    }

    .history-mini-row span {
        text-align: left;
    }

    .history-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .history-entry-cards {
        display: grid;
        gap: 8px;
    }

    .history-table-wrap {
        display: none;
    }

    .history-entry-card-top,
    .history-entry-card-status {
        flex-direction: column;
    }

    .history-entry-card-top span,
    .history-entry-card-status > span:last-child {
        text-align: left;
    }
}

@media (max-width: 360px) {
    .app-header {
        height: 48px;
        margin: 8px;
        padding: 0 6px;
    }

    .app-header h1 {
        font-size: 0.9rem;
        margin-right: 5px;
    }

    .header-actions {
        gap: 3px;
    }

    .icon-btn {
        height: 28px;
        width: 28px;
    }

    .icon-btn svg {
        height: 16px;
        width: 16px;
    }
}

/* ========================================
   Dashboard-aligned Break Tracker shell
   ======================================== */
.dashboard-icon {
    display: block;
    fill: none;
    stroke: var(--paper-outline);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    width: 24px;
    height: 24px;
}

.app-header {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto minmax(150px, 1fr);
    height: auto;
    min-height: 72px;
    padding: 8px 12px;
    gap: 12px;
}

.header-brand {
    align-items: center;
    color: var(--text-primary);
    display: inline-flex;
    gap: 10px;
    justify-self: start;
    min-width: 0;
    text-decoration: none;
}

.header-brand-icon,
.selection-icon,
.class-item-icon {
    align-items: center;
    background: var(--paper-accent-green);
    border: 2px solid var(--paper-outline);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
}

.header-brand-icon {
    height: 48px;
    width: 48px;
}

.header-brand-copy {
    display: grid;
    line-height: 1.15;
}

.header-brand-copy strong {
    font-size: 1.05rem;
    font-weight: 800;
}

.header-brand-copy small {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 4px;
}

.header-context {
    justify-self: center;
    min-width: 0;
}

.header-class-switch {
    align-items: center;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: grid;
    font-family: var(--font-family);
    gap: 9px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    max-width: min(430px, 42vw);
    min-height: 50px;
    padding: 6px 12px;
    text-align: left;
}

.header-class-switch:hover {
    background: var(--paper-accent-blue);
    transform: translateY(-1px);
}

.header-class-copy {
    display: grid;
    line-height: 1.15;
    min-width: 0;
}

.header-class-copy small {
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 700;
}

.header-class-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-actions {
    align-items: center;
    justify-self: end;
    position: relative;
}

.header-actions > .auth-btn {
    background: var(--paper-accent-pink);
    height: 46px;
    width: 46px;
}

.header-more-menu {
    position: relative;
}

.header-more-menu > summary {
    align-items: center;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 800;
    gap: 6px;
    list-style: none;
    min-height: 46px;
    padding: 7px 14px 7px 10px;
}

.header-more-menu > summary::-webkit-details-marker {
    display: none;
}

.header-more-menu[open] > summary,
.header-more-menu > summary:hover {
    background: var(--paper-accent-yellow);
}

.more-dots {
    font-size: 1.35rem;
    line-height: 1;
}

.header-more-popover {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 14px;
    box-shadow: 5px 5px 0 var(--paper-shadow);
    display: grid;
    gap: 5px;
    min-width: 230px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 200;
}

.header-menu-item,
.dashboard-link-btn.header-menu-item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 9px;
    box-shadow: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 700;
    gap: 11px;
    height: auto;
    justify-content: flex-start;
    padding: 10px 11px;
    text-decoration: none;
    width: 100%;
}

.header-menu-item:hover,
.dashboard-link-btn.header-menu-item:hover {
    background: var(--paper-accent-yellow);
    box-shadow: none;
    transform: none;
}

.header-menu-item svg,
.dashboard-link-btn.header-menu-item svg {
    height: 20px;
    width: 20px;
}

.screen {
    max-width: 1320px;
    padding: 10px 14px 18px;
    width: 100%;
}

.selection-container {
    margin: 18px auto;
    max-width: 980px;
    text-align: left;
}

.selection-heading {
    align-items: center;
    display: flex;
    gap: 16px;
    margin: 0 auto 18px;
    max-width: 760px;
}

.selection-icon {
    background: var(--paper-accent-green);
    height: 64px;
    width: 64px;
}

.selection-icon .dashboard-icon {
    height: 31px;
    width: 31px;
}

.selection-eyebrow {
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.selection-container h2 {
    font-size: 1.65rem;
    margin: 0;
}

.selection-container .subtitle {
    margin: 3px 0 0;
}

.class-section {
    padding: 16px;
}

.class-section-heading {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.class-section-heading h3 {
    color: var(--text-primary);
    font-size: 1.05rem;
    margin: 0;
}

.class-section-heading span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
}

.class-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.class-item {
    align-items: center;
    display: grid;
    font-family: var(--font-family);
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 78px;
    padding: 10px 12px;
    text-align: left;
    width: 100%;
}

.class-item-icon {
    background: var(--paper-accent-blue);
    height: 46px;
    width: 46px;
}

.class-item-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.class-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.class-item-count {
    font-size: 0.76rem;
}

.class-item-arrow {
    font-size: 1.25rem;
    font-weight: 800;
}

.class-header {
    margin-bottom: 10px;
}

.class-info {
    align-items: center;
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    display: grid;
    gap: 10px;
    grid-template-columns: auto auto minmax(190px, 1fr);
    padding: 8px 10px;
}

.class-info.toilet-status-hidden {
    grid-template-columns: auto auto;
    justify-content: start;
}

.tracker-today-context {
    align-items: center;
    display: flex;
    gap: 7px;
}

.tracker-today-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.current-date {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.time-period-badge {
    box-shadow: none;
    padding: 4px 9px;
}

.tracker-view-tabs {
    justify-self: start;
}

.shared-toilet-status-pill {
    justify-self: end;
}

.shared-toilet-status-pill summary {
    background: var(--paper-accent-green);
    font-size: 0.82rem;
    min-height: 38px;
    padding: 7px 12px;
}

.shared-toilet-status-pill .shared-toilet-status-popover {
    left: auto;
    right: 0;
}

.tracker-view-panel {
    margin-top: 0;
}

.student-grid {
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.student-card {
    container-type: inline-size;
    cursor: default;
    display: flex;
    flex-direction: column;
    min-height: 98px;
    overflow: hidden;
    padding: 0;
    text-align: left;
}

.student-card:hover {
    box-shadow: var(--shadow-md);
    transform: none;
}

.student-card-heading {
    align-items: flex-start;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-height: 43px;
    padding: 9px 10px 5px;
}

.student-name {
    font-size: 0.93rem;
    line-height: 1.2;
    margin: 0;
}

.student-status-dot {
    background: var(--warning-color);
    border: 2px solid var(--paper-outline);
    border-radius: 50%;
    box-shadow: 1px 1px 0 var(--paper-shadow);
    flex: 0 0 auto;
    height: 12px;
    width: 12px;
}

.student-actions {
    display: grid;
    flex: 1;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 7px 7px;
}

.student-actions:has(.student-action:nth-child(2)) .student-action-icon {
    display: block;
}

.student-actions:has(.student-action:nth-child(2)) .student-action {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 7px;
    justify-content: center;
    padding: 4px 6px;
    text-align: center;
}

.student-actions:has(.student-action:nth-child(2)) .student-action-count {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    font-size: 0.62rem;
    line-height: 1;
    min-width: 0;
    padding: 0;
    position: static;
    transform: none;
}

.student-actions:has(.student-action:nth-child(2)) .student-action-count::after {
    content: ' today';
}

.student-action {
    align-items: center;
    border: 2px solid var(--paper-outline);
    border-radius: 10px;
    box-shadow: 2px 2px 0 var(--paper-shadow);
    color: var(--text-primary);
    cursor: pointer;
    display: grid;
    font-family: var(--font-family);
    font-weight: 800;
    gap: 5px;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 43px;
    padding: 6px 34px 6px 8px;
    position: relative;
    text-align: left;
}

.student-action:only-child {
    grid-column: 1 / -1;
}

.student-action:hover {
    box-shadow: 3px 3px 0 var(--paper-shadow);
    transform: translateY(-1px);
}

.student-action-toilet {
    background: var(--paper-accent-purple);
}

.student-action-drink {
    background: var(--paper-accent-cyan);
}

.student-action-return {
    background: var(--paper-accent-yellow);
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-right: 8px;
}

.student-action-icon {
    fill: none;
    flex: 0 0 auto;
    height: 19px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 19px;
}

.student-action-label {
    font-size: 0.72rem;
    min-width: 0;
    white-space: nowrap;
}

.student-action-count {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.student-action-count,
.student-out-badge {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1.5px solid var(--paper-outline);
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.7rem;
    justify-content: center;
    min-width: 24px;
    padding: 1px 6px;
}

@container (max-width: 150px) {
    .student-action-icon {
        display: none;
    }

    .student-action {
        padding-left: 7px;
    }
}

@media (min-width: 1100px) {
    .student-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.student-card-out {
    background: #FFF8E8;
    border-color: var(--paper-outline);
}

@media (max-width: 820px) {
    .app-header {
        grid-template-columns: minmax(170px, 1fr) auto;
        grid-template-areas:
            "brand actions"
            "context context";
    }

    .header-brand {
        grid-area: brand;
    }

    .header-context {
        grid-area: context;
        justify-self: stretch;
    }

    .header-actions {
        grid-area: actions;
    }

    .header-class-switch {
        max-width: none;
        width: 100%;
    }

    .class-info {
        grid-template-columns: 1fr auto;
    }

    .shared-toilet-status-pill {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .shared-toilet-status-pill summary {
        width: 100%;
    }

    .student-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 560px) {
    .app-header {
        margin: 8px;
        min-height: 62px;
        padding: 7px 8px;
    }

    .header-brand-icon {
        height: 42px;
        width: 42px;
    }

    .header-brand-copy strong {
        font-size: 0.92rem;
    }

    .header-actions > .auth-btn,
    .header-more-menu > summary {
        min-height: 40px;
    }

    .header-actions > .auth-btn {
        height: 40px;
        width: 40px;
    }

    .header-more-menu > summary {
        padding: 5px 10px 5px 7px;
    }

    .header-more-popover {
        min-width: min(230px, calc(100vw - 24px));
    }

    .selection-heading {
        align-items: flex-start;
    }

    .selection-icon {
        height: 50px;
        width: 50px;
    }

    .class-list,
    .class-info {
        grid-template-columns: 1fr;
    }

    .tracker-today-context,
    .tracker-view-tabs,
    .shared-toilet-status-pill {
        justify-self: stretch;
    }

    .tracker-view-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .student-grid {
        gap: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .student-card {
        min-height: 100px;
    }

    .student-action-return {
        grid-column: 1;
    }
}

/* Dashboard-aligned shared-toilet workflow */
.student-action,
.student-actions:has(.student-action:nth-child(2)) .student-action {
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 6px 10px;
    text-align: center;
}

.student-action-label {
    font-size: 0.8rem;
}

.student-action-return,
.student-actions:has(.student-action:nth-child(2)) .student-action-return {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 6px 8px;
}

.shared-toilet-status-popover {
    gap: 10px;
    overflow: hidden;
    padding: 10px;
}

.shared-toilet-popover-heading {
    align-items: center;
    background: var(--paper-accent-green);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
}

.shared-toilet-popover-heading strong {
    font-size: 0.9rem;
}

.shared-toilet-popover-heading span {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
}

.shared-toilet-status-controls {
    background: #F5F7F8;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    padding: 8px 10px;
}

.shared-toilet-status-item {
    align-items: center;
    border-radius: var(--border-radius-sm);
    min-height: 48px;
    padding: 10px 12px;
}

.shared-toilet-status-item strong {
    font-size: 0.9rem;
}

.shared-toilet-status-item.is-in-use {
    background: var(--paper-accent-yellow);
}

.toilet-location-modal,
.return-confirm-modal {
    overflow: hidden;
    padding: 0;
}

.workflow-modal-heading {
    background: var(--paper-accent-yellow);
    border-bottom: 2px solid var(--paper-outline);
    padding: 18px 20px 16px;
}

.workflow-modal-heading.return-modal-heading {
    background: var(--paper-accent-green);
}

.workflow-modal-eyebrow {
    color: var(--primary-color);
    display: block;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.workflow-modal-heading h3,
.toilet-location-modal .workflow-modal-heading h3 {
    font-size: 1.35rem;
    margin: 0;
}

.workflow-modal-heading .break-prompt,
.toilet-location-modal .workflow-modal-heading .break-prompt {
    color: var(--text-secondary);
    margin: 4px 0 0;
}

.workflow-modal-body {
    padding: 18px 20px 20px;
}

.toilet-location-picker {
    margin-top: 0;
}

.toilet-location-option {
    background: var(--paper-accent-green);
    gap: 6px;
    min-height: 76px;
    padding: 12px;
}

.toilet-location-option.is-selected {
    background: var(--paper-accent-yellow);
    border-color: var(--paper-outline);
    box-shadow: 4px 4px 0 var(--paper-shadow);
}

.toilet-location-option.is-in-use {
    background: var(--paper-accent-purple);
    color: var(--text-primary);
    opacity: 0.74;
}

.toilet-location-detail:empty {
    display: none;
}

.toilet-location-option.is-selected .toilet-location-detail {
    color: var(--text-secondary);
}

.toilet-location-modal .modal-actions,
.return-confirm-actions {
    display: grid;
    grid-template-columns: minmax(100px, 0.7fr) minmax(180px, 1.3fr);
    margin-top: 18px;
}

.return-confirm-modal {
    text-align: left;
    width: min(460px, calc(100vw - 32px));
}

.return-confirm-actions {
    grid-template-columns: 1fr 1.35fr;
    justify-content: stretch;
    margin-top: 0;
}

@media (max-width: 560px) {
    .shared-toilet-status-popover {
        min-width: min(360px, calc(100vw - 24px));
    }

    .shared-toilet-popover-heading,
    .toilet-location-picker-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .toilet-location-hint {
        text-align: left;
    }

    .toilet-location-grid {
        grid-template-columns: 1fr;
    }

    .toilet-location-modal .modal-actions,
    .return-confirm-actions {
        grid-template-columns: 1fr;
    }
}

/* Dashboard-style settings workspace */
.settings-modal {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: min(860px, calc(100vh - 24px));
    overflow: hidden;
    padding: 0;
    width: min(780px, calc(100vw - 24px));
}

.settings-modal-header {
    background: var(--paper-accent-yellow);
    border-bottom: 2px solid var(--paper-outline);
    padding: 18px 22px 16px;
}

.settings-eyebrow {
    color: var(--primary-color);
    display: block;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.settings-modal .settings-modal-header h3 {
    font-size: 1.45rem;
    margin: 0;
}

.settings-modal-header .settings-description {
    margin: 4px 0 0;
}

.settings-modal-body {
    background: #F5F6F4;
    display: grid;
    gap: 12px;
    overflow-y: auto;
    padding: 16px 18px 20px;
    scrollbar-gutter: stable;
}

.settings-card {
    background: var(--paper-card);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 12px;
    padding: 14px;
}

.settings-school-card {
    background: var(--paper-accent-green);
}

.settings-toilet-card {
    background: #FFFDF8;
}

.settings-card-heading,
.settings-timeframes-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.settings-card-heading h4,
.settings-timeframes-header h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin: 0;
}

.settings-card-heading p,
.settings-timeframes-header p {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 2px 0 0;
}

.settings-card-heading .btn-ghost {
    flex: 0 0 auto;
    font-size: 0.75rem;
    padding: 7px 10px;
}

.settings-school-card .school-link-status {
    background: rgba(255, 255, 255, 0.62);
    margin: 0;
}

.settings-toggle-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-toggle-card {
    background: #F7F8F8;
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    min-height: 58px;
    gap: 12px;
    padding: 9px 11px;
}

.settings-toggle-card:has(input:checked) {
    background: var(--paper-accent-blue);
}

.settings-toilet-card .settings-toggle-card:has(input:checked) {
    background: var(--paper-accent-yellow);
}

.settings-toggle-card > span {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.settings-toggle-card strong {
    font-size: 0.83rem;
}

.settings-toggle-card small {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.25;
}

.settings-toggle-card input[type="checkbox"] {
    appearance: none;
    background: #DDE2E3;
    border: 2px solid var(--paper-outline);
    border-radius: 999px;
    flex: 0 0 auto;
    height: 22px;
    margin: 0;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
    width: 40px;
}

.settings-toggle-card input[type="checkbox"]::before {
    background: white;
    border: 0;
    border-radius: 50%;
    box-shadow: 1px 1px 0 rgba(47, 54, 56, 0.28);
    content: '';
    height: 14px;
    left: 3px;
    position: absolute;
    top: 2px;
    transition: transform 0.15s ease;
    width: 14px;
}

.settings-toggle-card input[type="checkbox"]:checked {
    background: var(--secondary-color);
}

.settings-toggle-card input[type="checkbox"]:checked::before {
    transform: translateX(18px);
}

.settings-toggle-card input[type="checkbox"]:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.settings-toggle-card:has(input:disabled),
.settings-location-field:has(textarea:disabled) {
    cursor: not-allowed;
    opacity: 0.55;
}

.settings-toggle-card:has(input:disabled:checked) {
    cursor: default;
    opacity: 1;
}

.settings-toggle-card:has(input:disabled:checked) input {
    display: none;
}

.settings-toggle-card:has(input:disabled:checked)::after {
    background: var(--paper-accent-green);
    border: 1.5px solid var(--paper-outline);
    border-radius: 999px;
    color: var(--text-primary);
    content: 'Required';
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 900;
    padding: 4px 8px;
}

.settings-toggle-card:has(input:disabled:checked) small {
    color: var(--text-secondary);
}

/* Compact, chronological activity view */
.daily-summary-content {
    column-count: initial;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-group {
    display: block;
    margin: 0;
}

.summary-group--active,
.summary-group--dense {
    grid-column: 1 / -1;
}

.summary-group--empty {
    box-shadow: 2px 2px 0 var(--paper-shadow);
}

.summary-group--empty .summary-group-header {
    background: #F3F6F3;
    border-bottom: 0;
    min-height: 0;
    padding: 8px 10px;
}

.summary-group--empty .summary-group-header h3 {
    font-size: 0.84rem;
}

.summary-group--empty .summary-group-time {
    font-size: 0.66rem;
}

.summary-group--empty .summary-group-total {
    background: transparent;
    border-width: 1.5px;
    box-shadow: none;
    color: var(--text-secondary);
    font-size: 0.66rem;
    padding: 2px 7px;
}

.today-log-header {
    gap: 10px;
    padding: 11px 14px;
}

.today-log-header > span:first-of-type {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 800;
}

.today-log-content {
    max-height: 280px;
    padding: 0 14px 14px;
}

.log-entry {
    gap: 12px;
    margin-bottom: 7px;
    min-height: 48px;
    padding: 7px 9px;
}

.log-entry-info {
    display: grid;
    flex: 1;
    gap: 7px;
    grid-template-columns: 52px minmax(150px, 1fr) auto auto auto;
    min-width: 0;
}

.log-entry-time {
    min-width: 0;
}

.log-entry-name {
    font-size: 0.84rem;
    font-weight: 800;
    min-width: 0;
    overflow-wrap: anywhere;
}

.log-entry-type,
.log-entry-location,
.log-entry-returned,
.log-entry-out {
    border: 1.5px solid var(--paper-outline);
    border-radius: 999px;
    box-shadow: none;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 7px;
    white-space: nowrap;
}

.log-entry-type.type-toilet {
    background: var(--paper-accent-purple);
}

.log-entry-type.type-drink {
    background: var(--paper-accent-cyan);
}

.log-entry-location {
    background: #F7F8F8;
}

.log-entry-returned {
    background: var(--paper-accent-green);
}

.log-entry-delete {
    align-items: center;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    padding: 0 9px;
    width: auto;
}

@media (max-width: 720px) {
    .daily-summary-content {
        grid-template-columns: 1fr;
    }

    .summary-group--active,
    .summary-group--dense {
        grid-column: 1;
    }

    .log-entry-info {
        display: flex;
        gap: 6px;
    }

    .log-entry-name {
        flex: 1 1 100%;
        order: -1;
    }
}

/* Remaining workflow polish */
.toast {
    animation: toastCornerIn 0.2s ease-out;
    bottom: 14px;
    left: auto;
    max-width: min(360px, calc(100vw - 28px));
    padding: 9px 12px;
    right: 14px;
    transform: none;
}

.toast.hiding {
    animation: toastCornerOut 0.2s ease-in forwards;
}

@keyframes toastCornerIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastCornerOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

.print-modal,
.export-modal,
.delete-entry-modal {
    overflow: hidden;
    padding: 0;
}

.print-modal {
    width: min(560px, calc(100vw - 24px));
}

.export-modal {
    max-height: min(760px, calc(100vh - 24px));
    width: min(620px, calc(100vw - 24px));
}

.export-print-heading {
    background: var(--paper-accent-blue);
}

.export-print-body {
    display: grid;
    gap: 14px;
}

.export-print-fields {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.export-print-fields .form-group {
    margin: 0;
}

.export-fields-group {
    margin: 0;
}

.export-fields-grid {
    background: #F5F7F8;
}

.export-print-actions,
.delete-entry-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    margin-top: 2px;
}

.delete-entry-modal {
    width: min(480px, calc(100vw - 24px));
}

.delete-modal-heading {
    background: var(--paper-accent-purple);
}

.btn-danger {
    background: var(--danger-color);
    border: 2px solid var(--paper-outline);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    color: white;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 800;
    padding: 10px 16px;
}

@media (max-width: 560px) {
    .export-print-fields,
    .export-print-actions,
    .delete-entry-actions {
        grid-template-columns: 1fr;
    }

    .toast {
        bottom: 10px;
        left: 10px;
        max-width: none;
        right: 10px;
    }
}

.settings-location-field {
    margin: 0;
}

.settings-location-field > label {
    margin-bottom: 2px;
}

.field-help {
    color: var(--text-secondary);
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 7px;
}

#settingToiletLocations {
    min-height: 76px;
    resize: vertical;
}

.settings-shared-heading {
    border-top: 2px dashed #CBD1D2;
    padding-top: 12px;
}

.shared-toilets-controls {
    background: var(--paper-accent-green);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    gap: 9px;
    padding: 11px;
}

.shared-toilets-status {
    color: var(--text-primary);
    font-weight: 800;
}

.shared-toilets-panel {
    background: rgba(255, 255, 255, 0.62);
    border: 1.5px solid var(--paper-outline);
    border-radius: 10px;
    padding: 10px;
}

.shared-toilets-actions {
    justify-content: flex-end;
}

.shared-toilets-actions .btn-ghost {
    font-size: 0.72rem;
    padding: 6px 9px;
}

.shared-toilets-panel .form-group {
    margin-bottom: 8px;
}

.settings-timeframes {
    box-shadow: var(--shadow-sm);
}

.settings-timeframes-header .btn-ghost {
    flex: 0 0 auto;
}

.summary-timeframe-row {
    background: #F7F8F8;
    box-shadow: none;
    padding: 9px;
}

.settings-modal-footer {
    background: var(--paper-card);
    border-top: 2px solid var(--paper-outline);
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    margin: 0;
    padding: 12px 18px 14px;
}

.settings-modal-footer button {
    min-height: 44px;
}

@media (max-width: 620px) {
    .settings-modal {
        max-height: calc(100vh - 12px);
        width: calc(100vw - 12px);
    }

    .settings-modal-header,
    .settings-modal-body,
    .settings-modal-footer {
        padding-left: 12px;
        padding-right: 12px;
    }

    .settings-card-heading,
    .settings-timeframes-header {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-toggle-grid,
    .settings-modal-footer {
        grid-template-columns: 1fr;
    }

    .settings-card-heading .btn-ghost,
    .settings-timeframes-header .btn-ghost {
        width: 100%;
    }
}
