/* ============================================
   THE AMPERSAND — Dashboard Styles v2
   Stitch Editorial UI + Rich Editor + Lavagna
   ============================================ */

/* --- Google Material Symbols --- */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ============================================
   LOGIN SCREEN
   ============================================ */
.dash-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-background);
    position: relative;
    overflow: hidden;
}

.dash-login-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* .ampersand-watermark is now an <img> — positioned via inline styles */

.dash-login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 3rem 2.5rem;
    background: var(--color-background);
    border: 1px solid var(--color-outline-variant);
    box-shadow: 0 20px 60px rgba(47, 52, 46, 0.06);
}

.dash-login-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dash-login-header img {
    display: block;
    margin: 0 auto 1.5rem;
}

.dash-login-header h1 {
    font-family: var(--font-headline);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.dash-login-header .subtitle {
    font-family: var(--font-label);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--color-on-surface-variant);
}

.dash-form-group {
    margin-bottom: 1.75rem;
}

.dash-form-group label {
    display: block;
    font-family: var(--font-label);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-on-surface-variant);
    margin-bottom: 0.5rem;
}

.dash-form-group input[type="text"],
.dash-form-group input[type="password"] {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-outline-variant);
    padding: 0.75rem 0;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-on-background);
    outline: none;
    transition: border-color 0.2s ease;
}

.dash-form-group input:focus {
    border-bottom-color: var(--color-primary);
}

.dash-login-error {
    display: none;
    text-align: center;
    color: var(--color-error);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dash-login-error.visible {
    display: block;
}

/* ============================================
   BUTTONS
   ============================================ */
.dash-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.75rem 1.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dash-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s ease;
}

.dash-btn:hover::after {
    background: rgba(255,255,255,0.08);
}

.dash-btn-primary {
    width: 100%;
    background-color: var(--color-on-surface);
    color: var(--color-background);
    padding: 1.25rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.dash-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 52, 46, 0.2);
}

.dash-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.625rem;
}

.dash-btn-action {
    background-color: var(--color-on-surface);
    color: var(--color-background);
}

.dash-btn-action:hover {
    box-shadow: 0 2px 8px rgba(47, 52, 46, 0.15);
}

.dash-btn-danger {
    background-color: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.dash-btn-danger:hover {
    background-color: var(--color-error);
    color: #fff;
}

.dash-btn-outline {
    background: transparent;
    border: 1px solid var(--color-outline-variant);
    color: var(--color-on-surface-variant);
}

.dash-btn-outline:hover {
    border-color: var(--color-on-surface);
    color: var(--color-on-surface);
}

.dash-btn-success {
    background-color: #2d4a37;
    color: #e8f5e9;
    border: none;
}

.dash-btn-success:hover {
    background-color: #1b3427;
}

.dash-btn-featured {
    background-color: transparent;
    color: #b8860b;
    border: 1px solid #b8860b;
}

.dash-btn-featured.active {
    background-color: #b8860b;
    color: #fff;
}

/* ============================================
   DASHBOARD SHELL
   ============================================ */
.dash-shell {
    display: none;
    min-height: 100vh;
    background-color: var(--color-background);
}

.dash-shell.active {
    display: block;
}

/* ============================================
   TOP BAR
   ============================================ */
.dash-topbar {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    z-index: 50;
    height: 56px;
    background: rgba(250, 249, 245, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    border-bottom: 1px solid rgba(175, 179, 172, 0.1);
}

.dash-topbar-brand {
    display: none;
}

.dash-topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* --- Notifications --- */
.dash-notif-wrapper {
    position: relative;
}

.dash-notif-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 320px;
    background: var(--color-surface);
    border: 1px solid var(--color-outline-variant);
    box-shadow: 0 4px 16px rgba(47, 52, 46, 0.1);
    z-index: 100;
    display: none;
    flex-direction: column;
}

.dash-notif-dropdown.active {
    display: flex;
}

.dash-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--color-outline-variant);
}

.dash-notif-header h3 {
    font-family: var(--font-heading);
    font-size: 0.875rem;
    margin: 0;
}

.dash-notif-list {
    max-height: 350px;
    overflow-y: auto;
}

.dash-notif-item {
    padding: 1rem;
    border-bottom: 1px solid var(--color-outline-variant);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: var(--color-on-surface);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dash-notif-item:hover {
    background: var(--color-surface-container-low);
}

.dash-notif-item.unread {
    background: var(--color-surface-variant);
}

.dash-notif-item.unread:hover {
    background: var(--color-surface-container-high);
}

.dash-notif-time {
    font-size: 0.6875rem;
    color: var(--color-on-surface-variant);
}

.dash-notif-empty {
    padding: 2rem;
    text-align: center;
    color: var(--color-on-surface-variant);
    font-size: 0.8125rem;
}

/* --- Mentions Autocomplete --- */
.mentions-autocomplete {
    position: absolute;
    background: var(--color-surface);
    border: 1px solid var(--color-outline-variant);
    box-shadow: 0 4px 12px rgba(47,52,46,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    min-width: 150px;
}
.mentions-autocomplete-item {
    padding: 0.5rem 1rem;
    font-family: var(--font-label);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.mentions-autocomplete-item:hover,
.mentions-autocomplete-item.active {
    background: var(--color-surface-variant);
}

/* Highlight Flash Animation */
@keyframes highlightFlash {
    0% { background-color: rgba(212,175,55,0.4); outline: 2px solid #b8860b; }
    100% { background-color: transparent; outline: 2px solid transparent; }
}
.highlight-flash {
    animation: highlightFlash 3s ease-out forwards;
}

.dash-topbar-user {
    font-family: var(--font-label);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: var(--color-on-surface-variant);
}

.dash-topbar-user strong {
    color: var(--color-on-surface);
    font-weight: 600;
}

.dash-topbar-role {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-on-surface-variant);
    background-color: var(--color-surface-container-high);
    padding: 0.2rem 0.5rem;
    display: inline-block;
}

.dash-btn-logout {
    font-family: var(--font-label);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-on-surface-variant);
    background: none;
    border: 1px solid transparent;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dash-btn-logout:hover {
    border-color: var(--color-error);
    color: var(--color-error);
}

/* ============================================
   SIDEBAR (Dark Editorial)
   ============================================ */
.dash-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background-color: #1A1A1A;
    z-index: 60;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.dash-sidebar::-webkit-scrollbar { width: 0; }

.dash-sidebar-brand {
    padding: 1.75rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.5rem;
}

.dash-sidebar-brand .logo-mark {
    height: 28px;
    width: auto;
    opacity: 0.3;
    filter: invert(1);
    margin-bottom: 0.5rem;
}

.dash-sidebar-brand .logo-text {
    font-family: var(--font-headline);
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.dash-sidebar-brand .logo-subtitle {
    font-family: var(--font-label);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 0.25rem;
}

.dash-sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.dash-sidebar-section { margin-bottom: 0.25rem; }

.dash-sidebar-label {
    font-family: var(--font-label);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.25);
    padding: 1rem 1.5rem 0.375rem;
    display: block;
}

.dash-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    font-family: var(--font-label);
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    text-decoration: none;
    position: relative;
}

.dash-sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8);
}

.dash-sidebar-item.active {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-weight: 600;
    border-left-color: #ffffff;
}

.dash-sidebar-item .material-symbols-outlined {
    font-size: 18px;
    opacity: 0.5;
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

.dash-sidebar-item.active .material-symbols-outlined {
    opacity: 1;
    font-variation-settings: 'FILL' 1, 'wght' 400;
}

.dash-sidebar-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transition: background-color 0.2s ease;
}

.dash-sidebar-footer:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.dash-sidebar-footer .user-pill {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
}

.dash-sidebar-footer .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-label);
    font-size: 0.5625rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
}

.dash-sidebar-footer .user-name {
    font-family: var(--font-label);
    font-size: 0.625rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-sidebar-footer .user-role {
    font-family: var(--font-label);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.3);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.dash-main {
    margin-left: 240px;
    margin-top: 56px;
    padding: 2.5rem 3rem 4rem;
    min-height: calc(100vh - 56px);
}

.dash-section {
    display: none;
    max-width: 980px;
    margin: 0 auto;
}

.dash-section.active {
    display: block;
    animation: fadeInSection 0.35s ease;
}

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

/* ============================================
   SECTION HEADERS — Editorial Style
   ============================================ */
.dash-section-header {
    margin-bottom: 2.5rem;
    position: relative;
}

.dash-section-header .section-overline {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--color-outline);
    display: block;
    margin-bottom: 0.5rem;
}

.dash-section-header h2 {
    font-family: var(--font-headline);
    font-size: 2.25rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    color: var(--color-on-background);
}

.dash-section-header p {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-on-surface-variant);
    line-height: 1.6;
    font-style: italic;
    max-width: 580px;
}

.dash-section-header .section-divider {
    width: 40px;
    height: 1px;
    background-color: var(--color-on-background);
    margin-top: 1.5rem;
    border: none;
}

/* ============================================
   FORMS
   ============================================ */
.dash-field {
    margin-bottom: 1.75rem;
}

.dash-field label {
    display: block;
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-outline);
    margin-bottom: 0.625rem;
}

.dash-field input[type="text"],
.dash-field input[type="password"],
.dash-field select,
.dash-field textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-outline-variant);
    padding: 0.75rem 0;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-on-background);
    outline: none;
    transition: border-color 0.3s ease;
}

.dash-field input:focus,
.dash-field select:focus,
.dash-field textarea:focus {
    border-bottom-color: var(--color-on-background);
}

.dash-field textarea {
    resize: vertical;
    min-height: 200px;
    line-height: 1.75;
    border: 1px solid var(--color-outline-variant);
    padding: 1rem;
    background: var(--color-surface-container-lowest);
}

.dash-field textarea:focus {
    border-color: var(--color-on-background);
}

.dash-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23787c75' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 1.5rem;
}

/* ============================================
   RICH TEXT EDITOR
   ============================================ */
.editor-wrapper {
    margin-bottom: 2rem;
}

/* Title / Subtitle inputs */
.editor-title-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font-headline);
    font-size: 2rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--color-on-background);
    outline: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.editor-title-input::placeholder {
    color: var(--color-outline-variant);
}

.editor-title-input:focus {
    border-bottom-color: var(--color-outline-variant);
}

.editor-subtitle-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-style: italic;
    color: var(--color-on-surface-variant);
    outline: none;
    padding: 0.375rem 0;
    margin-top: 0.25rem;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.editor-subtitle-input::placeholder {
    color: var(--color-outline-variant);
    font-style: italic;
}

.editor-subtitle-input:focus {
    border-bottom-color: var(--color-outline-variant);
}

/* Metadata row */
.editor-meta-row {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
    align-items: flex-end;
}

.editor-meta-row .dash-field {
    flex: 1;
    margin-bottom: 0;
}

/* Cover image */
.editor-cover-zone {
    width: 100%;
    aspect-ratio: 21/9;
    min-height: 200px;
    background: var(--color-surface-container-low);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px dashed var(--color-outline-variant);
    margin: 1.5rem 0;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}

.editor-cover-zone:hover {
    border-color: var(--color-outline);
    background: var(--color-surface-container);
}

.editor-cover-zone.has-image {
    border: none;
}

.editor-cover-zone img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.editor-cover-zone .cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    color: var(--color-outline);
    z-index: 1;
    padding: 1rem;
}

.editor-cover-zone .cover-placeholder .material-symbols-outlined {
    font-size: 32px;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.editor-cover-zone .cover-placeholder span {
    font-family: var(--font-label);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.editor-cover-zone .cover-placeholder span:not(.material-symbols-outlined) {
    text-transform: uppercase;
}

.editor-cover-zone .cover-placeholder .hint {
    font-size: 0.65rem;
    letter-spacing: 0;
    opacity: 0.6;
    text-transform: none !important;
    max-width: 100%;
}

.editor-cover-zone .cover-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
}

.editor-cover-zone:hover .cover-remove {
    opacity: 1;
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface-container-low);
    border: 1px solid var(--color-surface-container-high);
    border-bottom: none;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 30;
}

.editor-toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--color-outline-variant);
    margin: 0 0.375rem;
}

.editor-toolbar button,
.editor-toolbar select {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    color: var(--color-on-surface-variant);
    font-family: var(--font-label);
    font-size: 0.6875rem;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.editor-toolbar button:hover {
    background: var(--color-surface-container-high);
    color: var(--color-on-surface);
}

.editor-toolbar button.active {
    background: var(--color-on-surface);
    color: var(--color-background);
}

.editor-toolbar button .material-symbols-outlined {
    font-size: 18px;
    font-variation-settings: 'FILL' 0, 'wght' 400;
}

.editor-toolbar select {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.375rem 1.5rem 0.375rem 0.5rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23787c75' d='M2 3l3 4 3-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.25rem center;
}

.editor-toolbar .insert-group {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

/* Body area (contenteditable) */
.editor-body {
    min-height: 300px;
    padding: 1.25rem;
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-on-background);
    outline: none;
    overflow-y: auto;
}

.editor-body:empty::before {
    content: attr(data-placeholder);
    color: var(--color-outline-variant);
    font-style: italic;
}

.editor-body:focus {
    border-color: var(--color-outline);
}

/* Editor body inline styles */
.editor-body h2 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 500;
    margin: 1.5rem 0 0.75rem;
    line-height: 1.3;
}

.editor-body h3 {
    font-family: var(--font-headline);
    font-size: 1.125rem;
    font-weight: 500;
    margin: 1rem 0 0.5rem;
    line-height: 1.4;
}

.editor-body blockquote {
    border-left: 3px solid var(--color-surface-dim);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--color-on-surface-variant);
}

.editor-body mark {
    background-color: #fef3cd;
    padding: 0 0.125rem;
}

/* Inline media in editor */
.editor-media-block {
    margin: 1rem 0;
    position: relative;
}

.editor-media-block img,
.editor-media-block video {
    max-width: 100%;
    display: block;
}

.editor-media-block .media-caption {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--color-outline-variant);
    padding: 0.5rem 0;
    font-family: var(--font-label);
    font-size: 0.6875rem;
    color: var(--color-on-surface-variant);
    outline: none;
    background: transparent;
    font-style: italic;
}

.editor-media-block .media-caption::placeholder {
    color: var(--color-outline-variant);
}

.editor-media-block .media-remove {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.editor-media-block:hover .media-remove {
    opacity: 1;
}

.editor-media-block figcaption {
    padding: 0.5rem 0;
    font-family: var(--font-label);
    font-size: 0.6875rem;
    color: var(--color-on-surface-variant);
    font-style: italic;
    border-bottom: 1px solid var(--color-outline-variant);
    outline: none;
    min-height: 1.25rem;
}

.editor-media-block figcaption:empty::before {
    content: attr(data-placeholder);
    color: var(--color-outline-variant);
}

/* File attachment in editor */
.editor-file-block {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: var(--color-surface-container-low);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.editor-file-block .material-symbols-outlined {
    font-size: 20px;
    color: var(--color-outline);
}

.editor-file-block .file-name {
    font-family: var(--font-label);
    font-size: 0.75rem;
    color: var(--color-on-surface);
    flex: 1;
}

.editor-file-block .file-caption {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--color-outline-variant);
    padding: 0.375rem 0;
    font-family: var(--font-label);
    font-size: 0.625rem;
    color: var(--color-on-surface-variant);
    outline: none;
    background: transparent;
    margin-top: 0.25rem;
}

.editor-file-block a {
    font-family: var(--font-label);
    font-size: 0.75rem;
    color: var(--color-on-surface);
    text-decoration: underline;
    flex: 1;
}

.editor-file-block .file-size {
    font-family: var(--font-label);
    font-size: 0.625rem;
    color: var(--color-outline);
}

.editor-file-block .media-remove {
    background: transparent;
    border: none;
    color: var(--color-outline);
    cursor: pointer;
    font-size: 16px;
    padding: 0.25rem;
    transition: color 0.15s;
}

.editor-file-block .media-remove:hover {
    color: #C62828;
}

/* Editor actions bar */
.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-surface-container-high);
}

.editor-save-status {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-outline);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.editor-save-status .material-symbols-outlined {
    font-size: 14px;
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

.editor-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   TABLES
   ============================================ */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-label);
    font-size: 0.8125rem;
}

.dash-table th {
    text-align: left;
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-outline);
    padding: 0.75rem 1rem 0.75rem 0;
    border-bottom: 1px solid var(--color-on-background);
    font-weight: 600;
}

.dash-table td {
    padding: 1rem 1rem 1rem 0;
    border-bottom: 1px solid var(--color-surface-container-high);
    color: var(--color-on-surface);
    vertical-align: middle;
}

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

.dash-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   STATUS & ROLE BADGES
   ============================================ */
.dash-badge {
    display: inline-block;
    font-family: var(--font-label);
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.5rem;
}

.dash-badge-draft { background-color: var(--color-surface-container-high); color: var(--color-on-surface-variant); }
.dash-badge-pending { background-color: #f0e6c8; color: #6b5a2a; }
.dash-badge-published { background-color: #d8e8d4; color: #2d4a37; }
.dash-badge-rejected { background-color: #f0d4d4; color: #7a2e2e; }
.dash-badge-inviato { background-color: #e0e4dc; color: var(--color-on-surface-variant); }
.dash-badge-visto { background-color: #d4e3f0; color: #2a4a6b; }
.dash-badge-approvato { background-color: #d8e8d4; color: #2d4a37; }
.dash-badge-featured { background-color: #fef3cd; color: #856404; }

.dash-role-badge {
    display: inline-block;
    font-family: var(--font-label);
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.4rem;
}

.dash-role-headmaster { background-color: #1A1A1A; color: #faf9f5; }
.dash-role-director { background-color: var(--color-on-surface); color: var(--color-background); }
.dash-role-admin { background-color: var(--color-surface-container-highest); color: var(--color-on-surface); }
.dash-role-writer { background-color: var(--color-surface-container-high); color: var(--color-on-surface-variant); }

/* ============================================
   CARDS (Accent bar left)
   ============================================ */
.dash-card {
    position: relative;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    margin-bottom: 1.5rem;
    background: transparent;
    border: none;
    border-left: 3px solid var(--color-surface-dim);
    transition: all 0.25s ease;
}

.dash-card-cover {
    width: 100%;
    aspect-ratio: 21/9;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.dash-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dash-card:hover {
    border-left-color: var(--color-on-background);
    background-color: var(--color-surface-container-lowest);
}

.dash-card-title {
    font-family: var(--font-headline);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    color: var(--color-on-background);
}

.dash-card-meta {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-outline);
    margin-bottom: 0.625rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.dash-card-content {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--color-on-surface-variant);
    line-height: 1.65;
    margin-bottom: 1rem;
}

.dash-card-author {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    letter-spacing: 0.06em;
    color: var(--color-outline);
    margin-bottom: 0.75rem;
}

.dash-card-author strong { color: var(--color-on-surface); font-weight: 600; }

.dash-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
}

.dash-card .rejection-note {
    margin-top: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: #faf0f0;
    border-left: 2px solid var(--color-error);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: #7a2e2e;
    line-height: 1.5;
}

/* ============================================
   BACHECA — Tabs + La Lavagna
   ============================================ */
.bacheca-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
}

.bacheca-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    text-align: center;
    font-family: var(--font-label);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--color-outline-variant);
    background: transparent;
    color: var(--color-on-surface-variant);
}

.bacheca-tab:first-child { border-right: none; }

.bacheca-tab.active {
    background: var(--color-on-surface);
    color: var(--color-background);
    border-color: var(--color-on-surface);
}

.bacheca-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
}

.bacheca-header-row h3 {
    font-family: var(--font-headline);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--color-on-background);
}

.bacheca-header-row .timestamp {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    letter-spacing: 0.06em;
    color: var(--color-outline);
    text-transform: uppercase;
}

.bacheca-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.bacheca-input-row textarea {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-outline-variant);
    padding: 0.75rem 0;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-on-background);
    outline: none;
    resize: none;
    min-height: 50px;
    transition: border-color 0.2s ease;
}

.bacheca-input-row textarea:focus {
    border-bottom-color: var(--color-on-background);
}

/* Message cards (Appunti del Team) */
.bacheca-message {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-surface-container-high);
    transition: background 0.2s ease;
}

.bacheca-message:first-child { padding-top: 0; }
.bacheca-message:last-child { border-bottom: none; }

.bacheca-message:hover {
    background-color: var(--color-surface-container-lowest);
    padding-left: 0.75rem;
    margin-left: -0.75rem;
}

.bacheca-message .author-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.375rem;
}

.bacheca-message .author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--color-surface-container-highest);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-label);
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    flex-shrink: 0;
}

.bacheca-message .author {
    font-family: var(--font-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-on-surface);
}

.bacheca-message .section-tag {
    font-family: var(--font-label);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-outline);
}

.bacheca-message .time {
    font-family: var(--font-label);
    font-size: 0.5rem;
    color: var(--color-outline);
    letter-spacing: 0.06em;
    margin-left: auto;
}

.bacheca-message .text {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-on-surface-variant);
    line-height: 1.65;
    margin-top: 0.25rem;
    padding-left: 2.125rem;
}

/* Bacheca message done state */
.bacheca-message.msg-done .text {
    text-decoration: line-through;
    opacity: 0.45;
}

.bacheca-message.msg-done .author-row {
    opacity: 0.5;
}

.msg-done-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: var(--color-outline);
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.msg-done-btn:hover {
    color: var(--color-on-surface);
}

.msg-done-btn.checked {
    color: #4caf50;
}

.msg-done-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Bacheca reactions */
.msg-reactions {
    display: flex;
    gap: 0.375rem;
    padding-left: 2.125rem;
    margin-top: 0.5rem;
}

.msg-react-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: 1px solid transparent;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    cursor: pointer;
    color: var(--color-outline);
    font-family: var(--font-label);
    font-size: 0.625rem;
    transition: all 0.15s ease;
}

.msg-react-btn:hover {
    background: var(--color-surface-container-low);
    border-color: var(--color-outline-variant);
}

.msg-react-btn.active-like {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.08);
    border-color: rgba(76, 175, 80, 0.2);
}

.msg-react-btn.active-dislike {
    color: #e53935;
    background: rgba(229, 57, 53, 0.08);
    border-color: rgba(229, 57, 53, 0.2);
}

.react-count {
    font-weight: 700;
    min-width: 0.5rem;
}

/* Locali rubrica selector */
.bacheca-rubrica-selector {
    margin-bottom: 1.5rem;
}

.bacheca-rubrica-selector select {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-outline-variant);
    padding: 0.75rem 0;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-on-background);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23787c75' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 1.5rem;
}

/* ============================================
   LA LAVAGNA v2 — Interactive Board
   ============================================ */
.lavagna-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-surface-container-high);
}

.lavagna-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.lavagna-header h3 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 400;
    font-style: italic;
    color: var(--color-on-background);
}

.lavagna-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    align-items: center;
}

.lavagna-toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--color-outline-variant);
    margin: 0 0.25rem;
}

.lavagna-tool-btn.active {
    background-color: var(--color-on-surface) !important;
    color: var(--color-background) !important;
    border-color: var(--color-on-surface) !important;
}

/* Board container */
.lavagna-board-v2 {
    position: relative;
    min-height: 400px;
    background: var(--color-surface-container-low);
    overflow: hidden;
    border: 1px solid var(--color-surface-container-high);
    transition: all 0.3s ease;
}

.lavagna-section.lavagna-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    padding: 1.5rem;
    margin: 0;
    border: none;
    background: var(--color-background);
    display: flex;
    flex-direction: column;
}

.lavagna-section.lavagna-fullscreen .lavagna-board-v2 {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--color-outline-variant);
}

.lavagna-empty {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--color-outline);
    font-size: 0.875rem;
    text-align: center;
    padding: 4rem 2rem;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG connections layer */
.lavagna-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.lav-connection-line {
    stroke: var(--color-outline);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke 0.15s ease;
}

.lav-connection-line:hover {
    stroke: #e53935;
    stroke-width: 2.5;
    stroke-dasharray: none;
}

/* Canvas drawing layer */
.lavagna-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.lavagna-canvas.draw-active {
    pointer-events: auto;
    cursor: crosshair;
    z-index: 50;
}

.lavagna-canvas.erase-active {
    pointer-events: auto;
    cursor: cell;
    z-index: 50;
}

/* Draggable items */
.lav-item {
    position: absolute;
    z-index: 5;
    transition: box-shadow 0.15s ease;
    user-select: none;
}

.lav-item.dragging {
    z-index: 100;
    box-shadow: 8px 10px 24px rgba(0,0,0,0.2) !important;
}

.lav-item.connect-selected {
    outline: 2px dashed var(--color-on-surface);
    outline-offset: 3px;
}

.lav-item-drag-handle {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    cursor: grab;
    color: rgba(0,0,0,0.15);
    transition: color 0.15s;
    z-index: 3;
    line-height: 1;
}

.lav-item:hover .lav-item-drag-handle {
    color: rgba(0,0,0,0.4);
}

.lav-item-drag-handle:active {
    cursor: grabbing;
}

.lav-item-drag-handle .material-symbols-outlined {
    font-size: 16px;
}

.lav-item-delete {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 3;
}

.lav-item:hover .lav-item-delete { opacity: 1; }

.lav-item-done {
    position: absolute;
    bottom: 0.375rem;
    right: 0.375rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: rgba(0,0,0,0.2);
    transition: color 0.15s;
    z-index: 3;
}

.lav-item-done:hover { color: rgba(0,0,0,0.5); }

.lav-item-done .material-symbols-outlined { font-size: 16px; }

/* Post-it v2 */
.lav-postit {
    padding: 1.5rem 1rem 1rem;
    min-height: 100px;
    min-width: 150px;
    max-width: 200px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #333;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.1);
}

.lav-postit.color-yellow { background-color: #fef9c3; }
.lav-postit.color-blue { background-color: #dbeafe; }
.lav-postit.color-green { background-color: #dcfce7; }
.lav-postit.color-pink { background-color: #fce7f3; }

.lav-postit.postit-done {
    opacity: 0.5;
}

.lav-postit.postit-done .lav-postit-content {
    text-decoration: line-through;
}

.lav-postit.postit-done .lav-item-done {
    color: #4caf50;
}

.lav-postit-content {
    word-break: break-word;
}

.lav-postit-date {
    font-family: var(--font-label);
    font-size: 0.4375rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(0,0,0,0.3);
    margin-top: 0.5rem;
}

/* Image item v2 */
.lav-image-item {
    background: #fff;
    padding: 0.5rem;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.12);
    max-width: 220px;
}

.lav-image-item img {
    width: 100%;
    display: block;
    max-height: 160px;
    object-fit: cover;
}

.lav-image-caption {
    font-family: var(--font-label);
    font-size: 0.5rem;
    font-style: italic;
    color: var(--color-outline);
    text-align: center;
    padding: 0.25rem 0.125rem 0;
}

/* Text label item */
.lav-text-item {
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.85);
    border-left: 3px solid var(--color-on-surface);
    max-width: 240px;
    box-shadow: 1px 2px 6px rgba(0,0,0,0.08);
}

.lav-text-content {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-on-surface);
    word-break: break-word;
    padding-top: 0.75rem;
}

/* ============================================
   GROUP HEADERS
   ============================================ */
.dash-group-header {
    font-family: var(--font-headline);
    font-size: 1.125rem;
    font-weight: 400;
    padding: 0.75rem 0;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--color-on-background);
    margin-bottom: 1rem;
}

.dash-group-header:first-child { margin-top: 0; }

/* ============================================
   STATS CARDS
   ============================================ */
.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.dash-stat-card {
    padding: 1.5rem;
    background-color: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    text-align: center;
    transition: transform 0.2s ease;
}

.dash-stat-card:hover { transform: translateY(-2px); }

.dash-stat-card .stat-value {
    font-family: var(--font-headline);
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--color-on-background);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.dash-stat-card .stat-label {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-outline);
}

/* Staff cards */
.staff-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-surface-container-high);
    transition: background 0.2s ease;
}

.staff-card:hover {
    background-color: var(--color-surface-container-lowest);
    padding-left: 0.75rem;
    margin-left: -0.75rem;
}

.staff-card:last-child { border-bottom: none; }

.staff-card .staff-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-surface-container-highest);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-label);
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    flex-shrink: 0;
}

.staff-card .staff-info { flex: 1; min-width: 0; }

.staff-card .staff-name {
    font-family: var(--font-headline);
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-on-background);
}

.staff-card .staff-meta {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    color: var(--color-outline);
    letter-spacing: 0.04em;
    margin-top: 0.125rem;
}

.staff-card .staff-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ============================================
   EMPTY & LOADING STATES
   ============================================ */
.dash-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-outline);
}

.dash-empty .material-symbols-outlined {
    font-size: 48px;
    opacity: 0.15;
    display: block;
    margin-bottom: 1rem;
    font-variation-settings: 'FILL' 0, 'wght' 200;
}

.dash-empty p {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-style: italic;
    color: var(--color-outline);
}

.dash-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 0;
    color: var(--color-outline);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-style: italic;
}

.dash-loading::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--color-outline-variant);
    border-top-color: var(--color-on-surface);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   TOAST
   ============================================ */
.dash-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #1A1A1A;
    color: #faf9f5;
    font-family: var(--font-label);
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    padding: 0.875rem 1.25rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-width: 380px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.dash-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   MODAL
   ============================================ */
.dash-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 15, 13, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.dash-modal-overlay.visible { display: flex; }

.dash-modal {
    background: var(--color-background);
    border: 1px solid var(--color-outline-variant);
    max-width: 480px;
    width: 90%;
    padding: 2.5rem;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dash-modal h3 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.dash-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .dash-sidebar { width: 200px; }
    .dash-main { margin-left: 200px; }
    .dash-topbar { left: 200px; }
}

/* ============================================
   IL MIO TEAM — View Tabs & Cards
   ============================================ */
.team-view-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-outline-variant);
}

.team-view-tab {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-label);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-outline);
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.team-view-tab:hover {
    color: var(--color-on-surface);
}

.team-view-tab.active {
    color: var(--color-on-surface);
    font-weight: 700;
}

.team-view-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--color-on-surface);
}

/* --- By Sections View --- */
.team-section-group {
    margin-bottom: 2rem;
    border-left: 2px solid var(--color-surface-container-highest);
    padding-left: 1.5rem;
}

.team-section-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.team-section-header h3 {
    font-family: var(--font-headline);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--color-on-background);
    margin: 0;
}

.team-count {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-outline);
    margin-left: auto;
}

.team-empty-hint {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-style: italic;
    color: var(--color-outline);
    padding: 0.75rem 0;
}

.team-members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-member-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.team-member-card:hover {
    transform: translateX(3px);
    border-color: var(--color-outline-variant);
}

.team-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-surface-container-highest);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-label);
    font-size: 0.5625rem;
    font-weight: 700;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    flex-shrink: 0;
}

.team-member-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.team-member-name {
    font-family: var(--font-label);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-on-surface);
}

.team-member-role {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.team-other-sections {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    color: var(--color-outline);
    letter-spacing: 0.02em;
}

/* --- By Redattori View --- */
.team-writers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-writer-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.team-writer-card:hover {
    transform: translateX(3px);
    border-color: var(--color-outline-variant);
}

.team-writer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-surface-container-highest);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-label);
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    flex-shrink: 0;
}

.team-writer-info {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.team-writer-name {
    font-family: var(--font-label);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-on-surface);
}

.team-writer-sections {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.team-rub-tag {
    font-family: var(--font-label);
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.5rem;
}

.team-rub-tag.mine {
    background-color: var(--color-on-surface);
    color: var(--color-background);
}

.team-rub-tag.other {
    background-color: var(--color-surface-container-high);
    color: var(--color-outline);
    opacity: 0.5;
}

.team-no-section {
    font-family: var(--font-label);
    font-size: 0.5625rem;
    font-style: italic;
    color: var(--color-outline);
}

@media (max-width: 768px) {
    .dash-sidebar {
        transform: translateX(-100%);
        width: 240px;
        transition: transform 0.3s ease;
        z-index: 2000; /* Above topbar */
        position: fixed;
        height: 100vh;
    }
    .dash-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .dash-main { 
        margin-left: 0; 
        padding: 1rem; 
        margin-top: 64px; 
    }
    .dash-topbar { 
        left: 0; 
        padding: 0 1rem; 
        z-index: 1000; 
        height: 64px;
        justify-content: space-between;
    }
    .dash-topbar-brand { display: block; font-size: 0.875rem; }
    .dash-mobile-toggle { display: block !important; }
    
    /* Hide excessive topbar info on mobile to prevent squishing */
    .dash-topbar-user, .dash-topbar-role, .dash-topbar-right > a, .dash-topbar-right > .dash-btn-logout {
        display: none !important;
    }
    
    .dash-topbar-right { gap: 0.5rem; }
    
    .bacheca-input-row { flex-direction: column; }
    .dash-stats-grid { grid-template-columns: 1fr; }
    .dash-section-header h2 { font-size: 1.5rem; }
    .editor-meta-row { flex-direction: column; }
    .lavagna-board-v2 { min-height: 250px; }
}

/* Material icon ligature protection */
.material-symbols-outlined {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden;
}

/* ============================
    CALENDARIO
   ============================ */
#calendario-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-outline-variant);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#calendario-wrapper {
    min-height: 400px;
    margin-top: 2rem;
}

.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.cal-header h3 {
    font-size: 1.75rem;
    font-family: var(--font-headline);
    margin: 0;
    color: var(--color-on-background);
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--color-outline-variant);
    border: 1px solid var(--color-outline-variant);
}

.cal-day-header {
    background: var(--color-surface-variant);
    padding: 0.5rem;
    text-align: center;
    font-family: var(--font-label);
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.cal-day {
    background: var(--color-surface);
    min-height: 120px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cal-day.out-of-month {
    background: var(--color-surface-container-lowest);
    color: var(--color-outline);
}

.cal-day.today {
    background: var(--color-primary-container) !important;
}

.cal-day-number {
    font-weight: bold;
    font-family: var(--font-body);
    font-size: 0.875rem;
    align-self: flex-end;
    margin-bottom: 0.5rem;
}

.cal-item {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-body);
    font-weight: 500;
}

.cal-item.published {
    background: var(--color-surface-variant);
    color: var(--color-on-surface);
    border-left: 3px solid var(--color-primary);
}

.cal-item.scheduled {
    background: #e6f4ea;
    color: #137333;
    border-left: 3px solid #188038;
}

.cal-item.pending {
    background: #fce8e6;
    color: #c5221f;
    border-left: 3px solid #ea4335;
    border-style: dashed;
}

.cal-item.game {
    border-left-color: #fbbc04;
}
