* {
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* hidden atribut musí vyhrát vždy, i nad display:flex/grid v jiných pravidlech */
[hidden] {
    display: none !important;
}

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eff6ff;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
    --font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
}

/* --- Obsah stránky --- */
/* Styly navigace teď žijí přímo v components/nav-bar.js (Shadow DOM) */

main {
    max-width: 60rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* --- Hero (hlavní stránka) --- */

.hero {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 1.25rem;
    background: linear-gradient(135deg, var(--text), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-subtitle {
    max-width: 34rem;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

/* --- Moduly --- */

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1.25rem;
}

.module-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.module-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.module-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.module-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    font-weight: 800;
}

.module-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Výběr motivu --- */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1.25rem;
}

.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 1.25rem;
    padding: 1rem;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.theme-card.active {
    border-color: var(--accent);
}

.theme-preview {
    width: 100%;
    height: 4.5rem;
    border-radius: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
}

.theme-swatch {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
}

.theme-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.vizual-zprava {
    margin-top: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 1.2em;
}

.custom-editor {
    margin-top: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.part-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.part-tab {
    padding: 0.5rem 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.part-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.font-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.font-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.font-row select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.button-primary {
    align-self: flex-start;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 0.6rem;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.button-primary:hover {
    background: var(--accent-hover);
}

/* --- TODO / seznamy úkolů --- */

.todo-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
}

.todo-section h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--accent);
}

.todo-list {
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.todo-list li {
    color: var(--text);
    line-height: 1.5;
    font-size: 0.95rem;
}

.todo-list code {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.1rem 0.4rem;
    border-radius: 0.4rem;
    font-size: 0.85em;
}

/* --- Poznámky (Keep styl) --- */

.notes-guest {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

.notes-composer {
    max-width: 34rem;
    margin: 0 auto 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
}

.composer-title-input {
    width: 100%;
    border: none;
    background: none;
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    outline: none;
}

.notes-composer textarea {
    width: 100%;
    border: none;
    background: none;
    resize: vertical;
    font: inherit;
    color: var(--text);
    outline: none;
    min-height: 1.6rem;
}

.composer-toolbar {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.composer-colors {
    display: flex;
    gap: 0.4rem;
}

.color-swatch {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    padding: 0;
}

.color-swatch.active {
    border-color: var(--accent);
}

.composer-toolbar select,
.composer-toolbar input[type="date"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
}

.pin-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    filter: grayscale(1);
    opacity: 0.6;
}

.pin-toggle.active {
    filter: none;
    opacity: 1;
    border-color: var(--accent);
}

.composer-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.composer-cancel,
.composer-delete {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.composer-delete {
    color: #dc2626;
    border-color: #dc2626;
}

.notes-grid {
    columns: 4 14rem;
    column-gap: 1.25rem;
}

.note-card {
    position: relative;
    break-inside: avoid;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 1.1rem;
    padding: 1.1rem 1.1rem 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.note-card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.note-pin {
    background: none;
    border: none;
    cursor: pointer;
    filter: grayscale(1);
    opacity: 0.5;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.note-pin.active {
    filter: none;
    opacity: 1;
}

.note-text {
    margin: 0.5rem 0 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.note-card-footer {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.note-typ-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Barevné karty mají pevnou (světlou) barvu pozadí bez ohledu na motiv,
   proto potřebují i pevný tmavý text — jinak by v tmavém motivu splynul */
.note-card-colored,
.note-card-colored .note-card-header h3,
.note-card-colored .note-text {
    color: #1f2937;
}

.note-card-colored .note-typ-badge,
.note-card-colored .note-date {
    color: #4b5563;
}

.note-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    font-size: 0.9rem;
    padding: 0.2rem;
}

.note-card:hover .note-delete {
    opacity: 1;
}

.note-delete:hover {
    color: #dc2626;
}

/* --- Přesouvatelné moduly --- */

/* Stejný problém, co jsme řešili u .kb-main/.cal-main — globální main má
   max-width: 60rem, takže .modules-canvas (a tím i prostor na tažení modulů)
   byl zbytečně stísněný. Tady stačí jen zrušit strop šířky, žádný
   plnostránkový flex layout navíc netřeba (stránka normálně scrolluje). */
.poznamky-main {
    max-width: none;
    width: 100%;
}

.modules-canvas {
    position: relative;
    min-height: 45rem;
}

.draggable-module {
    width: 24rem;
    max-width: calc(100vw - 3rem);
    max-height: 90vh;
    min-width: 14rem;
    min-height: 8rem;
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: var(--shadow);
    overflow: auto;
    resize: both;
}

#notes-module {
    top: 0;
    left: 0;
}

#calendar-module {
    top: 0;
    left: 25.5rem;
    width: 18rem;
}

.module-handle {
    padding: 0.75rem 1rem;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: grab;
    user-select: none;
    border-bottom: 1px solid var(--border);
    touch-action: none;
}

.module-handle:active {
    cursor: grabbing;
}

.module-body {
    padding: 1.25rem;
}

.module-body .notes-composer {
    max-width: none;
    margin: 0 0 1.5rem;
    box-shadow: none;
    padding: 0;
    border: none;
}

/* --- Kalendář --- */

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.calendar-nav {
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    cursor: pointer;
    width: 1.8rem;
    height: 1.8rem;
    font-size: 1rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.2rem;
}

.calendar-day {
    aspect-ratio: 1;
    border: none;
    background: none;
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    position: relative;
}

.calendar-day:hover {
    background: var(--accent-soft);
}

.calendar-day.has-note::after {
    content: "";
    position: absolute;
    bottom: 0.15rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0.3rem;
    height: 0.3rem;
    border-radius: 50%;
    background: var(--accent);
}

.calendar-day-notes {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.calendar-day-notes p {
    margin: 0 0 0.4rem;
    color: var(--text);
}

/* --- Velké poznámky (kb) --- */

/* Plnostránkový 3sloupcový layout (styl Obsidianu) — jen pro tuhle stránku,
   proto vše přes body.kb-page, ne globálně. */

body.kb-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

body.kb-page nav-bar {
    flex-shrink: 0;
}

.kb-main {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.kb-sidebar-left {
    width: 17rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
}

.kb-sidebar-left-header {
    padding: 0.9rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kb-filters {
    margin-bottom: 0.5rem;
}

.kb-filters input,
#kb-typ-filter,
#kb-tag-filter {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
}

.kb-tree-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
}

.kb-list-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-family: inherit;
}

.kb-list-item:hover {
    background: var(--accent-soft);
}

.kb-list-item.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.kb-list-item-title {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text);
}

.kb-list-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.kb-tree-folder {
    margin-bottom: 0.1rem;
}

.kb-tree-folder > summary {
    cursor: pointer;
    padding: 0.35rem 0.4rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-muted);
    list-style: none;
}

.kb-tree-folder > summary::-webkit-details-marker {
    display: none;
}

.kb-tree-folder > summary::before {
    content: "▸";
    display: inline-block;
    width: 0.9rem;
    transition: transform 0.15s ease;
}

.kb-tree-folder[open] > summary::before {
    transform: rotate(90deg);
}

.kb-tree-folder > summary:hover {
    background: var(--accent-soft);
}

.kb-tree-folder > div {
    padding-left: 0.7rem;
    margin-left: 0.45rem;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-top: 0.15rem;
}

.kb-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kb-center-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.kb-editor-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kb-center-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kb-center-toolbar button,
.kb-toolbar-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.kb-center-toolbar button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.kb-save-btn {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white;
}

.kb-delete-btn {
    color: #dc2626;
    border-color: #dc2626 !important;
}

.kb-center-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.kb-title-input {
    width: 100%;
    font-size: 1.6rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 0.25rem 0;
    margin-bottom: 0.75rem;
    font-family: inherit;
}

.kb-title-input:focus {
    outline: none;
}

.kb-body-textarea {
    width: 100%;
    min-height: 60vh;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.9rem;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    line-height: 1.6;
}

.kb-preview {
    min-height: 60vh;
    line-height: 1.7;
}

.kb-preview .kb-wiki-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    cursor: pointer;
}

.kb-preview .kb-tag-link {
    display: inline-block;
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.85em;
    cursor: pointer;
}

.kb-properties {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.kb-property-row {
    display: flex;
    gap: 0.5rem;
}

.kb-property-row input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.kb-property-row input.kb-property-key {
    width: 9rem;
    font-weight: 600;
}

.kb-property-row input.kb-property-value {
    flex: 1;
}

.kb-property-row button {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.kb-sidebar-right {
    width: 16rem;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    padding: 1rem;
}

.kb-backlinks-section {
    margin-bottom: 1.5rem;
}

.kb-backlinks-section h4 {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kb-backlinks-section a {
    display: block;
    color: var(--accent);
    text-decoration: none;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

#kb-outline-list a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0;
    font-size: 0.8rem;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}

#kb-outline-list a:hover {
    color: var(--accent);
    border-left-color: var(--accent);
}

/* --- Kalendář (cal) — plnostránkový layout, stejný princip jako .kb-main --- */

body.cal-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

body.cal-page nav-bar {
    flex-shrink: 0;
}

.cal-main {
    flex: 1;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
    gap: 1rem;
    flex-wrap: wrap;
}

.cal-toolbar-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cal-toolbar-nav button,
.cal-view-switch button,
.cal-new-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.cal-view-switch {
    display: flex;
    gap: 0.3rem;
}

.cal-view-switch button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

#cal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 10rem;
}

.cal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cal-month-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cal-month-weekdays span {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cal-month-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    overflow: hidden;
}

.cal-month-cell {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0.35rem;
    overflow-y: auto;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cal-month-cell.cal-outside {
    background: var(--bg);
    color: var(--text-muted);
}

.cal-month-cell.cal-today .cal-month-daynum {
    background: var(--accent);
    color: white;
    border-radius: 50%;
}

.cal-month-daynum {
    font-size: 0.8rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cal-pill {
    font-size: 0.72rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.4rem;
    background: var(--accent-soft);
    color: var(--text);
    cursor: grab;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-pill.cal-dragging {
    opacity: 0.4;
}

.cal-month-cell.cal-drop-target {
    background: var(--accent-soft);
}

.cal-allday-row {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 1.8rem;
}

.cal-allday-gutter {
    width: 3.5rem;
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.2rem;
}

.cal-allday-cols {
    flex: 1;
    display: grid;
    gap: 2px;
    padding: 0.15rem;
}

.cal-timeline-wrap {
    flex: 1;
    overflow-y: auto;
}

.cal-timeline {
    display: flex;
    position: relative;
}

.cal-time-gutter {
    width: 3.5rem;
    flex-shrink: 0;
}

.cal-time-gutter span {
    display: block;
    height: 48px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    padding-right: 0.4rem;
    transform: translateY(-0.5em);
}

.cal-day-columns {
    flex: 1;
    display: grid;
    position: relative;
}

.cal-day-column {
    border-left: 1px solid var(--border);
    position: relative;
    background-image: repeating-linear-gradient(to bottom, var(--border) 0, var(--border) 1px, transparent 1px, transparent 48px);
}

.cal-event-block {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 0.4rem;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    font-size: 0.72rem;
    padding: 0.15rem 0.3rem;
    overflow: hidden;
    cursor: pointer;
}

.cal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.cal-modal {
    background: var(--surface);
    border-radius: 1rem;
    padding: 1.5rem;
    width: 26rem;
    max-width: 90vw;
    box-shadow: var(--shadow);
}

.cal-modal h3 {
    margin-top: 0;
}

.cal-modal label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.75rem 0 0.25rem;
}

.cal-modal input[type="text"],
.cal-modal input[type="datetime-local"],
.cal-modal select,
.cal-modal textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}

.cal-modal-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.cal-modal-checkbox label {
    margin: 0;
}

.cal-modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.cal-modal-actions button {
    padding: 0.5rem 1.1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

.cal-modal-save {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white;
}

.cal-modal-delete {
    color: #dc2626;
    border-color: #dc2626 !important;
}

/* --- Checklist (chk) --- */

.chk-add-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chk-add-form input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}

.chk-add-form .chk-kategorie-input {
    width: 12rem;
}

.chk-add-form .chk-text-input {
    flex: 1;
    min-width: 12rem;
}

.chk-add-form button {
    padding: 0.5rem 1.1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-family: inherit;
}

.chk-kategorie-group {
    margin-bottom: 1rem;
}

.chk-kategorie-group > summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.5rem 0;
    list-style: none;
    color: var(--text);
}

.chk-kategorie-group > summary::-webkit-details-marker {
    display: none;
}

.chk-kategorie-group > summary::before {
    content: "▸";
    display: inline-block;
    width: 1rem;
    transition: transform 0.15s ease;
}

.chk-kategorie-group[open] > summary::before {
    transform: rotate(90deg);
}

.chk-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    margin-bottom: 0.5rem;
    background: var(--surface);
}

.chk-stav-btn {
    flex-shrink: 0;
    border: none;
    border-radius: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    color: white;
}

.chk-stav-ceka {
    background: var(--text-muted);
}

.chk-stav-hotovo {
    background: #16a34a;
}

.chk-stav-problem {
    background: #dc2626;
}

.chk-item-body {
    flex: 1;
    min-width: 0;
}

.chk-item-text-input {
    width: 100%;
    display: block;
    resize: vertical;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    padding: 0.2rem 0.4rem;
    margin: -0.2rem -0.4rem 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
}

.chk-item-text-input:hover,
.chk-item-text-input:focus {
    border-color: var(--border);
    background: var(--bg);
    outline: none;
}

.chk-item-text-input.chk-done {
    text-decoration: line-through;
    color: var(--text-muted);
    font-weight: 400;
}

.chk-item-poznamka {
    width: 100%;
    resize: vertical;
    margin-top: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
}

.chk-item-delete {
    flex-shrink: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* --- Deskovky: knihovna her --- */

.game-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.game-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-primary {
    padding: 0.55rem 1.1rem;
    border-radius: 0.7rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1.25rem;
}

.game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.game-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.game-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: rgba(15, 23, 42, 0.75);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.game-card-body {
    padding: 0.9rem 1rem 1rem;
}

.game-card-body h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.game-tags span {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.game-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.empty-box {
    border: 2px dashed var(--border);
    border-radius: 1.25rem;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Deskovky: randomizer --- */

.dice-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 45rem) {
    .dice-layout { grid-template-columns: 1fr; }
}

.dice-display {
    font-size: 6rem;
    font-weight: 900;
    text-align: center;
    padding: 2rem 0;
    color: var(--accent);
    transition: transform 0.15s ease;
}

.dice-display.rolling {
    transform: rotate(8deg) scale(1.1);
}

.wonder-display {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    min-height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    text-align: center;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

.wonder-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.wonder-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.wonder-chip.pouzito {
    opacity: 0.35;
    text-decoration: line-through;
}

/* --- Kolekce: čaj --- */

.tea-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1.25rem;
}

.tea-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.1rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tea-card-image {
    position: relative;
    aspect-ratio: 4 / 5;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.tea-type-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: white;
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.tea-card-body {
    padding: 0.6rem 0.75rem 0.8rem;
}

.tea-brand {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 700;
}

.tea-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Bugreport --- */

.bug-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.bug-filters select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.bug-card {
    display: flex;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.1rem;
    padding: 1rem;
    margin-bottom: 0.9rem;
    box-shadow: var(--shadow);
}

.bug-meta {
    flex-shrink: 0;
    width: 9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.bug-status-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    text-align: center;
}

.bug-status-novy { background: #dc2626; }
.bug-status-resi_se { background: #d97706; }
.bug-status-opraveno { background: #16a34a; }
.bug-status-featura { background: #2563eb; }

.bug-priority {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bug-priority.vysoka { color: #d97706; font-weight: 700; }
.bug-priority.kriticka { color: #dc2626; font-weight: 700; }

.bug-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}

.bug-body h3 {
    margin: 0 0 0.4rem;
}

.bug-body p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    white-space: pre-wrap;
}

/* --- Nastavení: stav modulů --- */

.modstav-table {
    width: 100%;
    border-collapse: collapse;
}

.modstav-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent);
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.modstav-table th:last-child, .modstav-table td:last-child {
    text-align: right;
}

.modstav-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.modstav-verze {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.modstav-datum {
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
}

/* --- Homepage: připnuté moduly --- */

.module-card {
    position: relative;
}

.pin-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.65;
    filter: grayscale(1);
}

.pin-btn.pripnuto {
    opacity: 1;
    filter: none;
    border-color: var(--accent);
    background: var(--accent-soft);
}
