.std-demo {
    --gutter: 15%;
    --fs: 16px;
    --fg: #3e3e3e;
    --secondary-fg: #505050;
    --primary: #03739f;
    --bg: #d1d1d1;
    --secondary-bg: #f6f6f6;
    --transparent-bg: rgba(246, 246, 246, 0.58);
    --border: #afafaf;
    --secondary-border: #c1c1c1;
    --light-border: #cdcdcd;
    --radius: 10px;
    --small-shadow: 0 4px 12px rgba(5, 5, 5, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --blur: 15px;
    --red: #d5251c;
    --orange: #ff9500;
    --yellow: #ffcc00;
    --green: #1a973c;
    --blue: #007aff;
    --ink: #1f2937;
    font-family: "Inter", sans-serif;
    color: var(--fg);
    box-sizing: border-box;
}

.std-demo,
.std-demo *,
.std-demo *::before,
.std-demo *::after {
    box-sizing: border-box;
}

.std-demo {
    width: 100%;
    padding: 20px;
}

.std-demo-board {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.std-demo-window {
    min-width: 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(var(--blur));
}

.std-demo-window[data-app="calendar"] { grid-column: span 5; }
.std-demo-window[data-app="contacts"] { grid-column: span 3; }
.std-demo-window[data-app="notes"] { grid-column: span 4; }
.std-demo-window[data-app="editor"] { grid-column: span 7; }
.std-demo-window[data-app="sheets"] { grid-column: span 5; }

.std-demo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 8px;
    background: rgba(246, 246, 246, 0.42);
    border-bottom: 1px solid rgba(175, 175, 175, 0.7);
}

.std-demo-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(175, 175, 175, 0.65);
    flex: 0 0 auto;
}

.std-demo-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.std-demo-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
}

.std-demo-tools {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.std-demo-tool {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.65;
}

.std-demo-tool svg {
    width: 14px;
    height: 14px;
    display: block;
}

.std-demo-body {
    padding: 12px;
    background: rgba(255, 255, 255, 0.52);
}

.std-demo-muted { opacity: 0.72; }
.std-demo-small { font-size: 12px; }
.std-demo-strong { font-weight: 700; }

.std-demo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
}

.std-demo-button {
    font: inherit;
    border-radius: var(--radius);
    font-size: 13px;
    transition: all 100ms;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.4);
    color: var(--fg);
    padding: 6px 10px;
}

.std-demo-button.secondary { background: transparent; }

.std-demo-select,
.std-demo-input {
    font: inherit;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--secondary-bg);
    color: var(--fg);
}

.std-demo-select { padding: 5px 8px; }
.std-demo-input { width: 100%; padding: 7px 9px; }

.std-demo-calendar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.std-demo-calendar-title { margin-left: auto; font-weight: 700; }

.std-demo-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.std-demo-calendar-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.65;
    padding-bottom: 4px;
}

.std-demo-calendar-day {
    min-height: 92px;
    border: 1px solid rgba(193, 193, 193, 0.8);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.62);
    padding: 8px 7px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.std-demo-calendar-day.is-muted { opacity: 0.42; }
.std-demo-calendar-day.is-selected { box-shadow: inset 0 0 0 2px #20c05c; border-color: #20c05c; }
.std-demo-calendar-date { font-size: 12px; font-weight: 700; }

.std-demo-event {
    border-radius: 7px;
    padding: 5px 7px;
    color: #fff;
    font-size: 11px;
    line-height: 1.15;
    overflow: hidden;
}

.std-demo-calendar-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(175, 175, 175, 0.7);
    display: grid;
    gap: 8px;
}

.std-demo-agenda-item {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.std-demo-agenda-time { font-size: 12px; font-weight: 700; }

.std-demo-agenda-card {
    border: 1px solid rgba(193, 193, 193, 0.85);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.6);
    padding: 8px 10px;
}
.std-demo-contacts-layout {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 10px;
}

.std-demo-contact-list { display: grid; gap: 6px; }

.std-demo-contact-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    border-radius: var(--radius);
    border: 1px solid rgba(193, 193, 193, 0.85);
    background: rgba(255, 255, 255, 0.55);
    padding: 8px;
    cursor: pointer;
}

.std-demo-contact-item.is-active { box-shadow: inset 0 0 0 2px #20c05c; border-color: #20c05c; }

.std-demo-contact-avatar,
.std-demo-contact-photo {
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #e9d5ff);
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.std-demo-contact-avatar { width: 36px; height: 36px; font-size: 13px; }
.std-demo-contact-photo { width: 92px; height: 92px; margin: 0 auto 12px; font-size: 24px; }

.std-demo-contact-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.std-demo-contact-detail {
    border-radius: var(--radius);
    border: 1px solid rgba(193, 193, 193, 0.85);
    background: rgba(255, 255, 255, 0.58);
    padding: 12px;
    min-height: 258px;
}

.std-demo-contact-field { margin-top: 10px; }

.std-demo-notes-grid { column-count: 2; column-gap: 12px; }

.std-demo-note {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin-bottom: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(193, 193, 193, 0.85);
    padding: 10px 11px;
    box-shadow: var(--small-shadow);
}

.std-demo-note h4,
.std-demo-note p { margin: 0; }

.std-demo-note h4 { font-size: 13px; margin-bottom: 8px; }
.std-demo-note p { font-size: 12px; line-height: 1.45; }
.std-demo-note-meta { margin-bottom: 8px; font-size: 11px; opacity: 0.66; }

.std-demo-editor-shell {
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.std-demo-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.6);
}

.std-demo-editor-tool {
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.std-demo-editor-tool.active { background: rgba(3, 115, 159, 0.12); border-color: rgba(3, 115, 159, 0.22); }
.std-demo-editor-tool svg { width: 18px; height: 18px; display: block; }

.std-demo-editor-stage { position: relative; display: grid; }
.std-demo-editor-backdrop,
.std-demo-editor-pages { grid-area: 1 / 1; }

.std-demo-editor-backdrop {
    display: flex;
    flex-direction: column;
    gap: 28px;
    pointer-events: none;
}

.std-demo-editor-page-card {
    width: min(100%, 680px);
    margin: 0 auto;
    min-height: 940px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.std-demo-editor-pages {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.std-demo-editor-page {
    width: min(100%, 680px);
    min-height: 940px;
    margin: 0 auto;
    padding: 72px;
    background: transparent;
    color: var(--ink);
    line-height: 1.55;
}

.std-demo-editor-page h2,
.std-demo-editor-page h3,
.std-demo-editor-page p,
.std-demo-editor-page ul { margin: 0 0 16px; }

.std-demo-editor-page ul { padding-left: 22px; }
.std-demo-editor-page li { margin-bottom: 10px; }

.std-demo-editor-callout {
    border-left: 4px solid var(--primary);
    padding: 10px 14px;
    background: rgba(3, 115, 159, 0.08);
    border-radius: 10px;
}

.std-demo-sheet-shell {
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.std-demo-sheet-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.6);
}

.std-demo-sheet-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.std-demo-sheet-formula { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.std-demo-sheet-cell-label {
    min-width: 44px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 8px;
    background: var(--secondary-bg);
}

.std-demo-sheet-grid-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.72);
}
.std-demo-sheet-grid {
    display: grid;
    grid-template-columns: 46px repeat(8, 120px);
    min-width: max-content;
}

.std-demo-sheet-header,
.std-demo-sheet-row-header,
.std-demo-sheet-cell {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.std-demo-sheet-header,
.std-demo-sheet-row-header {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    padding: 8px 6px;
    background: var(--secondary-bg);
}

.std-demo-sheet-row-header { position: sticky; left: 0; z-index: 1; }
.std-demo-sheet-header.corner { position: sticky; left: 0; z-index: 2; }

.std-demo-sheet-cell {
    min-height: 42px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.72);
    font-size: 13px;
}

.std-demo-sheet-cell.is-active { box-shadow: inset 0 0 0 2px #20c05c; }
.std-demo-sheet-cell.type-number,
.std-demo-sheet-cell.right { text-align: right; }
.std-demo-sheet-cell.fill-blue { background: #dbeafe; }
.std-demo-sheet-cell.fill-green { background: #dcfce7; }
.std-demo-sheet-cell.fill-yellow { background: #fef3c7; }
.std-demo-sheet-cell.text-blue { color: #2563eb; }
.std-demo-sheet-cell.text-green { color: #166534; }
.std-demo-sheet-cell.text-red { color: #b91c1c; }
.std-demo-sheet-cell.bold { font-weight: 700; }
.std-demo-sheet-cell.center { text-align: center; }

@media (max-width: 1320px) {
    .std-demo-window[data-app="calendar"],
    .std-demo-window[data-app="contacts"],
    .std-demo-window[data-app="notes"],
    .std-demo-window[data-app="editor"],
    .std-demo-window[data-app="sheets"] {
        grid-column: span 6;
    }
}

@media (max-width: 960px) {
    .std-demo { padding: 12px; }
    .std-demo-board { grid-template-columns: 1fr; }
    .std-demo-window[data-app="calendar"],
    .std-demo-window[data-app="contacts"],
    .std-demo-window[data-app="notes"],
    .std-demo-window[data-app="editor"],
    .std-demo-window[data-app="sheets"] { grid-column: span 1; }
    .std-demo-contacts-layout { grid-template-columns: 1fr; }
    .std-demo-notes-grid { column-count: 1; }
    .std-demo-calendar-grid { gap: 4px; }
    .std-demo-calendar-day { min-height: 84px; }
    .std-demo-editor-page-card,
    .std-demo-editor-page { width: 100%; }
    .std-demo-editor-page { padding: 32px 22px; min-height: 0; }
    .std-demo-editor-page-card { min-height: 0; }
}
