:root {
    color-scheme: light;
    --accent: #4f46e5;
    --accent-dark: #4338ca;
    --accent-tint: #eef2ff;
    --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover: 0 4px 14px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
}
header.site { background: #e3ecf9; padding: 14px 24px; border-bottom: 1px solid rgba(79,70,229,.10); }
header.site { display: flex; align-items: center; justify-content: space-between; }
header.site .brand { color: #1d1d1f; text-decoration: none; font-size: 18px; font-weight: 600; }
.site-nav { display: flex; align-items: center; gap: 14px; }
.site-nav a, .logout button { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 7px; color: #1d1d1f; font-size: 14px; font-weight: 500; text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit; transition: background .15s, color .15s; }
.site-nav a:hover, .logout button:hover { background: rgba(79,70,229,.10); color: var(--accent); }
.logout { margin: 0; }

.layout { display: flex; gap: 24px; max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.layout > main { flex: 1; min-width: 0; }
.sidebar { flex: 0 0 190px; }
.sidebar-right { flex: 0 0 190px; }
@media (max-width: 720px) { .layout { flex-direction: column; } .sidebar, .sidebar-right { flex: 1 1 auto; } }
.att-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 9px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }
.att-badge .clip { flex: 0 0 auto; }
.sidebar h2 { display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; color: var(--accent); letter-spacing: .05em; font-weight: 700; margin-bottom: 10px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px; background: var(--accent-tint); color: var(--accent); text-decoration: none; font-size: 13px; transition: background .15s; }
.tag-chip:hover { background: #e0e4fb; }
.tag-chip.active { background: var(--accent); color: #fff; }
.tag-chip-count { font-size: 10px; font-weight: 700; background: rgba(79,70,229,.14); color: var(--accent); padding: 0 6px; border-radius: 99px; }
.tag-chip.active .tag-chip-count { background: rgba(255,255,255,.25); color: #fff; }

main { flex: 1; min-width: 0; }
.search { display: flex; gap: 8px; margin-bottom: 20px; }
.search input[type=search] {
    flex: 1; padding: 9px 14px; font-size: 15px;
    border: 1px solid #d2d2d7; border-radius: 10px; background: #fff;
}
.search input[type=search]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
button, .search button {
    padding: 9px 18px; font-size: 14px; border: 0; border-radius: 10px;
    background: var(--accent); color: #fff; cursor: pointer; transition: background .15s;
}
button:hover, .search button:hover { background: var(--accent-dark); }
button.danger { background: #c62828; }

.item { background: #fff; border-radius: 14px; padding: 16px 20px; margin-bottom: 14px; box-shadow: var(--card-shadow); border-left: 3px solid var(--accent); transition: box-shadow .15s, transform .15s; }
.item:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.item h2 { margin: 6px 0; font-size: 17px; }
.item h2 a { color: #1d1d1f; text-decoration: none; }
.item h2 a:hover { color: #0071e3; }
.meta { font-size: 13px; color: #6e6e73; }
.tag {
    display: inline-block; margin-left: 6px; padding: 1px 9px;
    background: var(--accent-tint); border-radius: 99px;
    color: var(--accent); text-decoration: none; font-size: 12px;
}
.snippet { margin: 4px 0 0; font-size: 14px; color: #424245; }
mark { background: #fff3b8; border-radius: 3px; }
.empty { color: #6e6e73; }
.pager { display: flex; gap: 16px; justify-content: center; margin: 20px 0; font-size: 14px; }

.detail { max-width: 760px; margin: 24px auto; padding: 0 16px; }
.detail h1 { font-size: 22px; margin: 8px 0; }
.actions { display: flex; gap: 10px; margin: 14px 0; font-size: 14px; }
.actions a {
    padding: 5px 14px; border-radius: 8px;
    background: #e8e8ed; color: #1d1d1f; text-decoration: none;
}
.actions a.active { background: var(--accent); color: #fff; }
iframe.mail-frame {
    width: 100%; height: calc(100vh - 250px); min-height: 420px;
    border: 1px solid #d2d2d7; border-radius: 12px; background: #fff;
}
pre.mail-txt {
    white-space: pre-wrap; background: #fff; padding: 24px;
    border-radius: 12px; font-size: 14px; line-height: 1.5;
}

.admin { max-width: 900px; margin: 24px auto; padding: 0 16px; }
.admin table { border-collapse: collapse; width: 100%; background: #fff; border-radius: 12px; box-shadow: var(--card-shadow); overflow: hidden; }
.admin td, .admin th {
    padding: 8px 12px; border-bottom: 1px solid #e5e5ea;
    text-align: left; font-size: 14px;
}
.admin th { background: var(--accent-tint); color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; border-bottom: 0; }
.admin .log-error td { color: #c62828; }
.admin form { margin: 14px 0; }
.admin input[type=text] {
    width: 100%; max-width: 420px; padding: 8px 12px;
    border: 1px solid #d2d2d7; border-radius: 8px; font-size: 14px;
}
.notice { background: #fff3e0; border-left: 3px solid #ef8f00; padding: 10px 14px; border-radius: 6px; }
.hint { color: #6e6e73; font-size: 13px; }
.raw-headers { background: #f5f5f7; padding: 12px 16px; border-radius: 8px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.attachments { background: #fff; border-radius: 14px; padding: 14px 16px; margin: 14px 0; box-shadow: var(--card-shadow); border-left: 3px solid var(--accent); }
.att-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.att-title { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #1d1d1f; }
.att-meta { background: var(--accent-tint); color: var(--accent); font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; }
.att-zip { display: inline-flex; align-items: center; gap: 5px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; text-decoration: none; }
.att-zip:hover { background: var(--accent-dark); }
.attachments ul { list-style: none; margin: 0; padding: 0; }
.attachments li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f0f0f4; }
.att-name { flex: 1; min-width: 0; font-size: 13px; color: #1d1d1f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments .att-size { color: #86868b; font-size: 12px; }
.att-dl { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-tint); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex: 0 0 auto; transition: background .15s, color .15s; }
.att-dl:hover { background: var(--accent); color: #fff; }
.ft { font-size: 9px; font-weight: 700; padding: 3px 5px; border-radius: 4px; letter-spacing: .03em; color: #fff; flex: 0 0 auto; }
.ft-pdf { background: #e7322e; }
.ft-file { background: #8a8f98; }
.item { display: flex; gap: 16px; align-items: flex-start; }
.item-main { flex: 1; min-width: 0; }
.item-tags { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 560px) {
  .item { flex-direction: column; gap: 8px; }
  .item-tags { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
}
.month-list { list-style: none; margin: 0 0 16px; padding: 0; }
.month-list .year { font-weight: 600; color: #1d1d1f; margin-top: 6px; }
.month-list .year > ul { list-style: none; margin: 2px 0 0; padding: 0 0 0 8px; font-weight: 400; }
.month-list a { display: block; padding: 3px 8px; border-radius: 6px; color: #1d1d1f; text-decoration: none; font-size: 14px; }
.month-list a:hover { background: var(--accent-tint); }
.month-list a.active { background: var(--accent); color: #fff; font-weight: 600; }
.month-list a.active .count { color: #dfe1fb; }
.month-list .count { color: #6e6e73; }
.login { max-width: 360px; margin: 48px auto; padding: 0 16px; }
.login label { display: block; margin: 12px 0; font-size: 14px; color: #424245; }
.login input { width: 100%; padding: 8px 10px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 15px; box-sizing: border-box; }
.login button { margin-top: 10px; padding: 8px 18px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-size: 15px; cursor: pointer; }
.back-link { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 8px; background: var(--accent-tint); color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; transition: background .15s; }
.back-link:hover { background: #e0e4fb; }
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--accent-dark); }
.btn-ghost { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; background: var(--accent-tint); color: var(--accent); font-size: 12px; font-weight: 500; text-decoration: none; transition: background .15s; }
.btn-ghost:hover { background: #e0e4fb; }
.tag-suggest { margin: 8px 0 14px; }
.tag-suggest-label { display: block; font-size: 12px; color: #86868b; margin-bottom: 6px; }
.tag-cloud-edit { display: flex; flex-wrap: wrap; gap: 6px; }
button.tag-chip { border: 0; cursor: pointer; font-family: inherit; }
.tag-input-wrap { position: relative; display: block; max-width: 420px; }
.tag-ac { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid #e0e0e8; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.10); margin-top: 4px; overflow: hidden; }
.tag-ac-item { padding: 6px 12px; font-size: 13px; cursor: pointer; color: #1d1d1f; }
.tag-ac-item:hover, .tag-ac-item.sel { background: var(--accent-tint); color: var(--accent); }

/* Filtr příloh + zrušení filtrů (řádek pod hledáním) */
.filter-row { display: flex; align-items: center; gap: 14px; margin: -8px 0 18px; }
.att-filter { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px; background: var(--accent-tint); color: var(--accent); text-decoration: none; font-size: 13px; transition: background .15s; }
.att-filter:hover { background: #e0e4fb; }
.att-filter.active { background: var(--accent); color: #fff; }
.clear-filters { font-size: 13px; color: #8b8fa3; text-decoration: none; }
.clear-filters:hover { color: var(--accent); }

/* Křížové zvýraznění: tag/měsíc bez výskytu v aktivním filtru je šedý
   a neklikatelný (renderuje se jako <span>, ne <a>) — bez fialové, ať je
   neaktivita zřejmá na první pohled */
.tag-chip.dim { background: #f1f2f5; color: #b4b8c2; cursor: default; }
.tag-chip.dim .tag-chip-count { background: rgba(0, 0, 0, .05); color: #b4b8c2; }
.month-list .dim { display: block; padding: 3px 8px; border-radius: 6px; color: #b4b8c2; font-size: 14px; cursor: default; }
.month-list .dim .count { color: #c9ccd4; }

/* --- administrace: filtry a hromadné operace --- */
.admin-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.admin-filters input[type=search] { flex: 1 1 200px; min-width: 160px; padding: 8px 12px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 14px; font-family: inherit; }
.admin-filters select { padding: 8px 10px; border: 1px solid #d2d2d7; border-radius: 8px; background: #fff; font-size: 14px; font-family: inherit; color: #1d1d1f; }
.admin-filters .admin-att { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.admin-filters button { padding: 8px 16px; }
.admin-count { color: #6e6e73; font-size: 13px; margin: 0 0 10px; }

.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; margin: 0 0 10px; background: var(--accent-tint); border-radius: 10px; }
.bulk-bar .bulk-count { font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.bulk-bar .tag-input-wrap { flex: 1 1 220px; min-width: 180px; }
.bulk-bar input[type=text] { width: 100%; padding: 7px 12px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 14px; font-family: inherit; }
.bulk-bar button { padding: 7px 14px; font-size: 13px; }

.select-all-row { margin: 0 0 10px; padding: 8px 14px; background: #fff8e1; border-left: 3px solid #ef8f00; border-radius: 6px; font-size: 13px; }
.select-all-row label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.admin .col-check { width: 34px; text-align: center; }
.admin .col-check input { cursor: pointer; }
.admin tr:has(.row-check:checked) { background: var(--accent-tint); }
.admin td.empty { text-align: center; color: #6e6e73; padding: 20px; }

.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 12px 0; }
.flash-ok { background: #e8f5e9; border-left: 3px solid #2e7d32; color: #1b5e20; }
.flash-warn { background: #fff3e0; border-left: 3px solid #ef8f00; color: #7a4f00; }

/* --- výzva k přihlášení --- */
.login-prompt { max-width: 560px; margin: 60px auto; padding: 0 16px; text-align: center; }
.login-prompt h1 { font-size: 24px; margin-bottom: 12px; }
.login-prompt p { color: #6e6e73; line-height: 1.6; }
.login-prompt .btn { margin-top: 8px; padding: 10px 22px; font-size: 15px; }
.login-prompt-admin { margin-top: 28px; font-size: 13px; }
.login-prompt-admin a { color: #6e6e73; }

.site-user { font-size: 13px; color: #6e6e73; white-space: nowrap; }
