@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #F5F3EF;
  --surface:       #FFFFFF;
  --border:        #E0DDD7;
  --text:          #1E2022;
  --text-muted:    #6B6B6B;
  --primary:       #E07B00;
  --primary-hover: #C96E00;
  --primary-light: #FFF3E0;
  --danger:        #DC2626;
  --danger-light:  #FEF2F2;
  --success:       #16A34A;
  --success-light: #F0FDF4;
  --warning:       #D97706;
  --warning-light: #FFFBEB;
  --charcoal:      #1E2022;
  --charcoal-mid:  #2C2F33;
  --header-h:      54px;
  --toolbar-h:     46px;
  --radius:        8px;
  --shadow:        0 1px 4px rgba(0,0,0,.09);
  --shadow-md:     0 4px 16px rgba(0,0,0,.13);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.screen { width: 100%; }

/* ── Login ────────────────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, var(--charcoal) 0%, var(--charcoal-mid) 50%, #3a2800 100%);
}
.login-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 10px; }
.login-logo-img { height: 72px; width: auto; object-fit: contain; margin-bottom: 10px; }
.login-box h1 {
  font-family: 'Oswald', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 4px;
  color: var(--charcoal);
}
.login-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 12px; }
.login-box form { text-align: left; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.field input {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 16px; outline: none; transition: border-color .15s;
  font-family: inherit;
}
.field input:focus { border-color: #777; }
.field input[type="checkbox"] { width: auto; padding: 0; border: none; }
.field input[type="date"]::-webkit-calendar-picker-indicator,
.field input[type="time"]::-webkit-calendar-picker-indicator { width: 20px; height: 20px; cursor: pointer; }
.error-msg {
  background: var(--danger-light); color: var(--danger);
  padding: 8px 12px; border-radius: var(--radius);
  font-size: 12px; margin-bottom: 12px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s; white-space: nowrap;
  font-family: inherit;
}
.btn-full { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 8px; font-size: 12px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--charcoal);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { font-size: 22px; }
.header-title {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff;
}
.header-title-sub {
  font-size: 11px;
  opacity: .55;
  font-weight: 400;
  letter-spacing: .06em;
  margin-left: 2px;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.header-user {
  font-size: 12px; font-weight: 500; opacity: .9;
  white-space: nowrap;
}
.app-header .btn-outline { color: #fff; border-color: rgba(255,255,255,.35); }
.app-header .btn-outline:hover { background: rgba(255,255,255,.1); }
.app-header .btn-ghost { color: rgba(255,255,255,.65); border-color: rgba(255,255,255,.2); }
.app-header .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Accent stripe under header */
.app-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar {
  height: var(--toolbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 8px;
}
.toolbar-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.select-sm {
  padding: 4px 28px 4px 8px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 12px; outline: none; cursor: pointer; max-width: 160px;
  font-family: inherit; background-color: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.select-sm:focus { border-color: #777; }

/* Universal arrow — survives any background-color override */
.select-sm,
.modal-body select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
}
.toggle-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted); cursor: pointer; white-space: nowrap;
}
.toggle-label input { cursor: pointer; accent-color: var(--primary); }

/* ── Profile modal ───────────────────────────────────────────────────────── */
.profile-info {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0 8px; gap: 4px;
}
.profile-role {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary); font-family: 'Oswald', sans-serif;
}
.profile-name {
  font-family: 'Oswald', sans-serif;
  font-size: 24px; font-weight: 600; color: var(--charcoal);
}

/* ── Level badges ────────────────────────────────────────────────────────── */
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  font-family: 'Oswald', sans-serif;
  flex-shrink: 0;
  cursor: default;
  letter-spacing: 0;
}
.level-beginner  { background: #F3F4F6; color: #1F2937; border: 1.5px solid #9CA3AF; }
.level-approved  { background: #FEF9C3; color: #854D0E; border: 1.5px solid #FDE047; }
.level-certified { background: #DCFCE7; color: #14532D; border: 1.5px solid #4ADE80; }

/* Dog name colors by level */
.level-name-approved  { color: #854D0E; font-weight: 500; }
.level-name-certified { color: #14532D; font-weight: 500; }

/* ── Type & status badges ────────────────────────────────────────────────── */
.type-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 14px; cursor: default;
}
.type-tr  { background: var(--primary-light); color: var(--primary); }
.type-sb  { background: var(--warning-light); color: var(--warning); }
.type-uch { background: #F3E8FF; color: #7C3AED; }
.cancelled-badge {
  display: inline-block; background: var(--danger-light); color: var(--danger);
  font-size: 8px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  font-family: 'Oswald', sans-serif; letter-spacing: .04em;
}

/* ── SUBTYPE TAGS ────────────────────────────────────────────────────────── */
.subtype-tag {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: #e8f4e8; color: #2d7a3a; border: 1px solid #b8ddb8;
  white-space: nowrap;
}
.subtype-tag:has(+ .subtype-tag) { margin-right: 3px; }
.subtype-tag-sm {
  font-size: 10px; padding: 0 4px; flex-shrink: 0; white-space: nowrap;
}
.dh-subtypes { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }

/* ── TLIST TOOLBAR (desktop, inside left column) ────────────────────────── */
.tlist-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; gap: 8px; flex-shrink: 0;
  height: 40px;
  background: var(--charcoal);
  border-bottom: 1px solid var(--border);
}
.tlist-toolbar .select-sm {
  background-color: rgba(255,255,255,.12); color: #fff;
  border-color: rgba(255,255,255,.2); font-size: 12px;
  padding: 4px 24px 4px 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.7)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.tlist-toolbar .select-sm option { background: var(--charcoal); color: #fff; }
.tlist-toolbar-title {
  font-size: 14px; font-weight: 700; color: #fff;
  white-space: nowrap; flex-shrink: 0;
}
.tlist-toolbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tlist-toolbar .btn { font-size: 12px; padding: 4px 8px; }
.tlist-toolbar .btn-primary { background: var(--primary); color: #fff; border: none; }
.tlist-toolbar .btn-ghost { color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.2); }
.tlist-toolbar .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── DESKTOP SPLIT LAYOUT ────────────────────────────────────────────────── */
.journal-layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* Left column wrapper */
.tlist-column {
  width: 25%; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
}

/* Left: training list */
.training-list-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
}

.tlist-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  user-select: none;
}
.tlist-item:hover { background: #faf9f6; }
.tlist-item.selected {
  background: var(--primary-light);
  border-left: 3px solid rgba(0,0,0,.12);
  padding-left: 9px;
}
.tlist-item.cancelled-row { opacity: .55; }

.tlist-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 6px;
  min-width: 0;
}
.tlist-left {
  display: flex; align-items: center; gap: 5px;
  min-width: 0; flex: 1; overflow: hidden;
}
.tlist-icon { font-size: 12px; flex-shrink: 0; line-height: 1; }
.tlist-date { font-weight: 700; font-size: 12px; flex-shrink: 0; white-space: nowrap; }
.tlist-sep  { color: var(--border); font-size: 12px; flex-shrink: 0; }
.tlist-loc-link {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; min-width: 0; flex-shrink: 1;
}
.tlist-loc-link:hover { color: var(--primary); text-decoration: underline; }
.tlist-right { flex-shrink: 0; }
.tlist-count {
  font-size: 12px; font-weight: 700; color: var(--success);
  background: var(--success-light); padding: 0 8px; border-radius: 10px;
}
.tlist-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* Right: detail panel */
.training-detail-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.detail-placeholder {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: 12px; font-size: 16px;
}
.detail-placeholder-icon { font-size: 40px; opacity: .5; }

.detail-header {
  background: var(--surface);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* Left group */
.dh-left {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; flex: 1;
}

/* Large type icon */
.dh-icon .type-badge { width: 40px; height: 40px; font-size: 22px; flex-shrink: 0; }

/* Date / time block */
.dh-datetime {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
  border-left: 1px solid var(--border); padding-left: 12px; margin-left: 4px;
}
.dh-date {
  font-family: 'Oswald', sans-serif;
  font-size: 20px; font-weight: 600; letter-spacing: .02em;
}
.date-dow { color: var(--text-muted); font-weight: 400; font-size: 12px; font-family: 'Inter', sans-serif; }
.dh-time {
  font-family: 'Oswald', sans-serif;
  font-size: 20px; font-weight: 600; color: var(--primary);
}

/* Location + subtypes group */
.dh-loc-group {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
  border-left: 1px solid var(--border); padding-left: 12px; margin-left: 4px;
}
.dh-loc { font-size: 12px; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
a.dh-loc:hover { color: var(--primary); text-decoration: underline; }

/* Notes bar below header */
.detail-notes-bar {
  font-size: 12px; color: var(--text-muted); font-style: italic;
  padding: 6px 20px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

/* Yes count block */
.dh-count {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  flex-shrink: 0; padding: 0 4px;
  border-left: 1px solid var(--border); padding-left: 12px; margin-left: 4px;
}
.dh-count-item {
  display: flex; flex-direction: column; align-items: center;
}
.dh-yes-num {
  font-family: 'Oswald', sans-serif;
  font-size: 28px; font-weight: 700; color: var(--success); line-height: 1;
}
.dh-yes-lbl {
  font-size: 8px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-top: 4px;
}

/* Filter label */
.dh-filter {
  font-size: 12px; white-space: nowrap; flex-shrink: 0;
  border-left: 1px solid var(--border); padding-left: 12px; margin-left: 4px;
}

/* Right group — action buttons */
.dh-right {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.dh-action-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.dh-action-btn:hover {
  background: var(--bg); color: var(--text); border-color: var(--text-muted);
}

.detail-table-wrap { padding: 16px 20px; }
.detail-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.detail-table thead th {
  background: var(--charcoal);
  color: #fff;
  font-family: 'Oswald', sans-serif;
  font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 8px 16px; text-align: left;
}
.detail-table tbody tr { border-bottom: 1px solid var(--border); }
.detail-table tbody tr:last-child { border-bottom: none; }
.detail-table tbody tr:hover td { background: #faf9f6; }
.detail-table tbody td { padding: 8px 16px; font-size: 14px; background: var(--surface); }
.detail-table .my-dog-row td { background: #fff9f0; }
.detail-table .my-dog-row td:first-child { border-left: 3px solid var(--primary); }

.th-dog     { width: 20%; }
.th-status  { width: 72px; text-align: center; }
.th-owner   { width: 20%; }
.th-comment { width: 30%; }
.th-video   { width: 22%; }
.detail-dog-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.detail-dog-name.dog-name-clickable { cursor: pointer; }
.detail-dog-name.dog-name-clickable:hover { color: var(--primary); text-decoration: underline; }
.detail-dog-owner { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1280px) {
  .detail-dog-owner { white-space: nowrap; }
}

/* Dog form sections */
.dog-form-section-title {
  font-family: 'Oswald', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px; margin-top: 4px;
}
.dog-form-допуски {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px;
}
.detail-empty { text-align: center; color: var(--text-muted); padding: 28px; }

/* Status cell */
.att-status-cell {
  width: 68px; text-align: center;
  padding: 6px 12px !important;
  vertical-align: middle;
}

/* iOS toggle */
.ios-toggle {
  display: inline-block;
  width: 24px; height: 14px; border-radius: 7px;
  background: #D1D5DB;
  position: relative; cursor: pointer;
  transition: background .22s;
  flex-shrink: 0; vertical-align: middle;
}
.ios-toggle.on { background: var(--success); }
.ios-toggle.disabled { cursor: default; opacity: .5; }
.ios-toggle::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.22);
}
.ios-toggle.on::after { transform: translateX(10px); }

/* Comment cell */
.att-cmt-cell { padding: 4px 16px !important; transition: background .1s; }
.att-cmt-cell.clickable { cursor: pointer; }
.csr-summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 24px; }
.csr-sum-wish    { font-size: 12px; color: var(--primary); font-style: italic; }
.csr-sum-comment { font-size: 12px; color: var(--text-muted); }
.csr-sum-videos  { font-size: 12px; color: var(--text-muted); }

.csr-sum-empty {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  background: transparent;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.att-cmt-cell.clickable:hover .csr-sum-empty {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Inline comment sub-row */
.comment-sub-row td { background: #faf9f6 !important; }
.csr-cell { padding: 14px 20px !important; border-bottom: 2px solid var(--primary) !important; }
.csr-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.csr-field label {
  display: block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); margin-bottom: 4px;
}
.csr-field textarea,
.csr-field input[type="text"],
.csr-field input[type="url"] {
  width: 100%; padding: 8px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; outline: none; font-family: inherit;
}
.csr-field textarea { resize: vertical; }
.csr-field textarea:focus,
.csr-field input:focus { border-color: #777; }
.video-inputs-container { display: flex; flex-direction: column; gap: 5px; }
.video-input-row { display: flex; gap: 6px; align-items: center; }
.video-url-input { flex: 1; }
.csr-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Video cell */
.att-vid-cell { padding: 8px 16px; font-size: 14px; }
.att-vid-cell.clickable { cursor: pointer; }
.vid-links { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.vid-link { font-size: 16px; line-height: 1; text-decoration: none; opacity: .85; transition: opacity .1s; }
.vid-link:hover { opacity: 1; }

/* Sub-row sections */
.csr-section { }
.csr-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Row action buttons */
.btn-icon {
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  border-radius: 4px; font-size: 12px; color: var(--text-muted); transition: all .1s;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); }

/* ── MOBILE CARDS ────────────────────────────────────────────────────────── */
.cards-container {
  overflow-y: auto;
  height: calc(100vh - var(--header-h) - var(--toolbar-h));
  padding: 8px 12px 24px;
  display: flex; flex-direction: column; gap: 4px;
}

.training-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.card-header {
  padding: 12px 14px; cursor: pointer;
  display: flex; align-items: flex-start; gap: 10px;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.card-header:active { background: var(--bg); }
.card-info { flex: 1; min-width: 0; }
.card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.card-datetime { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.card-date { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 16px; line-height: 1.1; }
.card-time { font-size: 11px; color: var(--text-muted); line-height: 1.1; }
.card-counts { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.card-loc  { font-size: 12px; color: var(--text-muted); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0; }
a.card-loc:hover { color: var(--primary); text-decoration: underline; }
.card-meta { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px 6px; overflow: hidden; }
.card-count {
  font-size: 12px; font-weight: 700; color: var(--success);
  background: var(--success-light); padding: 0 8px; border-radius: 20px;
}
.card-header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.card-action-btn { padding: 6px 8px !important; font-size: 16px !important; opacity: 0.7; }
.card-action-btn:active { opacity: 1; }
.card-action-danger { color: var(--danger) !important; }
.card-body { border-top: 1px solid var(--border); }

/* Dog rows in mobile card */
.dog-row {
  display: flex; align-items: center; padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6; gap: 8px; min-height: 48px;
}
.dog-row:last-child { border-bottom: none; }
.dog-row.my-dog { background: #fff9f0; border-left: 3px solid var(--primary); }
.dog-row-info { flex: 1; min-width: 0; }
.dog-row-name  { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.dog-row-owner { font-size: 12px; color: var(--text-muted); }
.dog-row-cmt   { font-size: 12px; color: var(--primary); font-style: italic; margin-top: 4px; }
.dog-row-btns  { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.dog-row-info.dog-name-clickable { cursor: pointer; }
.dog-row-info.dog-name-clickable:active { opacity: .7; }

.sq-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer; border: 1.5px solid transparent;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
}
.sq-cmt {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer;
  background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted);
  transition: all .15s;
}
.sq-cmt.has-cmt { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.sq-cmt:active { transform: scale(.92); }

/* ── Attendance Popup (desktop) ──────────────────────────────────────────── */
.att-popup {
  position: fixed;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md);
  width: 280px; z-index: 200; overflow: hidden;
}
.att-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--charcoal); color: #fff;
  font-size: 12px; font-weight: 600; font-family: 'Oswald', sans-serif;
  letter-spacing: .04em;
}
.att-popup-header button { background: none; border: none; color: #fff; cursor: pointer; font-size: 16px; opacity: .8; }
.att-popup-header button:hover { opacity: 1; }
.att-popup-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.att-status-row { display: flex; gap: 8px; }
.att-btn {
  flex: 1; padding: 8px 4px; border-radius: var(--radius);
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s;
  font-family: inherit;
}
.att-yes { background: var(--success-light); color: var(--success); border-color: var(--success); }
.att-yes:hover, .att-yes.active { background: var(--success); color: #fff; }
.att-no  { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger); }
.att-no:hover, .att-no.active   { background: var(--danger);  color: #fff; }
.att-clear { background: var(--bg); color: var(--text-muted); border-color: var(--border); }
.att-clear:hover { background: var(--border); }
.att-comment-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.hint { font-weight: 400; font-size: 11px; text-transform: none; letter-spacing: 0; }
.att-comment-row input, .bs-body .att-comment-row input {
  width: 100%; padding: 8px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; outline: none; font-family: inherit;
}
.att-comment-row input:focus, .bs-body .att-comment-row input:focus { border-color: #777; }
.bs-body .att-comment-row textarea {
  width: 100%; padding: 8px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; outline: none; font-family: inherit; resize: vertical;
}
.bs-body .att-comment-row textarea:focus { border-color: #777; }

/* ── Bottom Sheet (mobile) ───────────────────────────────────────────────── */
.bs-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300;
}
.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  z-index: 301;
  padding-bottom: env(safe-area-inset-bottom, 12px);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,1,.23,1);
  box-shadow: 0 -4px 28px rgba(0,0,0,.18);
}
.bottom-sheet.open { transform: translateY(0); }
.bs-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: #D1D5DB; margin: 10px auto 0;
}
.bs-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 6px; font-size: 15px; font-weight: 600;
  font-family: 'Oswald', sans-serif; letter-spacing: .04em;
}
.bs-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; }
.bs-body { padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 12px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 300; display: flex; align-items: flex-start; justify-content: center;
  padding: 12px; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 12px;
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,.28); overflow: hidden;
  margin-top: 12px; flex-shrink: 0;
  display: flex; flex-direction: column;
}
@media (max-width: 767px) {
  .modal-overlay { padding: 10px; }
  .modal { margin-top: 10px; max-width: 100%; border-radius: 12px; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--charcoal); color: #fff; flex-shrink: 0;
}
.modal-header h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: rgba(255,255,255,.7); padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { color: #fff; background: rgba(255,255,255,.1); }
#stats-year-select { margin-left: auto; margin-right: 10px; font-size: 13px; max-width: 120px; }
.modal-body {
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.modal-body .field label { color: var(--text); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.modal-body select {
  width: 100%; padding: 8px 36px 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 16px; outline: none; font-family: inherit; background-color: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.modal-body select:focus { border-color: #777; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }

/* Manage tabs */
.manage-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.manage-tab {
  padding: 8px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; background: none; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
  font-family: 'Oswald', sans-serif; letter-spacing: .04em; text-transform: uppercase;
}
.manage-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.manage-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.manage-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg); border-radius: var(--radius); font-size: 12px;
  border: 1px solid var(--border);
}
.manage-item-info { flex: 1; }
.manage-item-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.manage-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.manage-item-actions { display: flex; gap: 4px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
/* Header title variants */
.title-short { display: none; }
.title-full  { display: inline; }
.btn-icon-m  { display: none; align-items: center; }

@media (max-width: 767px) {
  :root { --header-h: 50px; --toolbar-h: 46px; }
  .btn-label { display: none; }
  .tlist-toolbar { display: none; }

  .journal-layout { display: none !important; }
  .cards-container { display: flex; }

  /* Header mobile */
  .title-full  { display: none; }
  .title-short { display: inline; }
  .header-user { display: none; }
  .btn-icon-m  { display: inline-flex; }
  .btn-icon-m svg { display: block; }
  #btn-profile, #btn-manage, #btn-logout { padding: 6px 8px; border-radius: 8px; }

  .header-title { font-size: 18px; }

  .toolbar { flex-wrap: nowrap; height: var(--toolbar-h); padding: 0 10px; gap: 6px; }
  .toolbar-left  { gap: 5px; flex-shrink: 0; }
  .toolbar-right { gap: 5px; flex-shrink: 0; }
  .select-sm { font-size: 12px; padding: 4px 24px 4px 8px; max-width: 90px; }
  .btn-icon-only { padding: 4px 8px; font-size: 16px; }
  #btn-add-training, #btn-add-dog { font-size: 12px; padding: 4px 8px; }

  /* Modal grids → single column on mobile */
  .dog-form-допуски { grid-template-columns: 1fr; }
  .csr-grid-2 { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  .journal-layout { display: flex; }
  .cards-container { display: none !important; }
  .bottom-sheet, .bs-overlay { display: none !important; }
  .toolbar-mobile { display: none !important; }
}

/* ── Header logo image ───────────────────────────────────────────────────── */
.header-logo-img { height: 36px; width: auto; object-fit: contain; }

/* ── Stats table ─────────────────────────────────────────────────────────── */
.stats-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.stats-table th { background: var(--charcoal); color: #fff; padding: 8px 12px; text-align: left; font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.stats-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.stats-table tbody tr:hover td { background: #faf9f6; }
.modal-wide { max-width: 680px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-wide .modal-body { overflow-y: auto; flex: 1; min-height: 0; }
@media (max-width: 767px) { .modal-wide { max-width: 100%; } }

.stats-table td { white-space: nowrap; }
.stats-table-fluid td { white-space: normal; word-break: break-word; }
/* Stats desktop/mobile toggle */
.stats-mobile { display: none; }
@media (max-width: 767px) {
  .stats-desktop { display: none; }
  .stats-mobile  { display: flex; flex-direction: column; gap: 6px; }
}

/* Stats mobile cards */
.stats-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.stats-card-top { display: flex; align-items: center; gap: 8px; }
.stats-card-name { font-weight: 600; font-size: 16px; }
.stats-card-owner { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.stats-card-nums { display: flex; gap: 0; border-top: 1px solid var(--border); padding-top: 8px; }
.stats-card-num { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 4px; }
.stats-card-num + .stats-card-num { border-left: 1px solid var(--border); }
.scn-val { font-size: 16px; font-weight: 700; color: var(--text); }
.stats-card-num.total .scn-val { color: var(--success); }
.scn-lbl { font-size: 20px; line-height: 1; }

.stats-summary { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; padding: 12px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.stats-summary-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 12px; }
.stats-summary-row + .stats-summary-row { border-top: 1px solid var(--border); }
.stat-yes  { color: var(--success); font-weight: 700; text-align: center; }
.stat-no   { color: var(--danger);  font-weight: 700; text-align: center; }
.stat-none { color: var(--text-muted); text-align: center; }
.stat-num  { color: var(--text-muted); text-align: center; font-size: 12px; }

/* ── Summary modal ───────────────────────────────────────────────────────── */
.summary-header { background: var(--charcoal); color: #fff; padding: 16px 20px; border-radius: var(--radius) var(--radius) 0 0; margin: -20px -20px 16px; }

/* Summary header: светлый в темах dashboard и modern */
[data-theme="dashboard"] .summary-header,
[data-theme="modern"] .summary-header {
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: -20px -20px 16px;
}
[data-theme="modern"] .summary-header {
  background: #e3ddd2;
  border-bottom: 1px solid #cec8bf;
}

/* Summary body with inner scroll */
.summary-body {
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  display: flex; flex-direction: column; gap: 0;
}

/* Info rows */
.summary-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.summary-row:last-of-type { border-bottom: none; }
.summary-lbl { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; flex-shrink: 0; }
.summary-val { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.summary-count { font-size: 16px; font-weight: 700; color: var(--text); }
.summary-loc { color: var(--primary); text-decoration: none; font-weight: 500; }
.summary-loc:hover { text-decoration: underline; }

/* Dog lists */
.summary-dogs { margin-top: 8px; display: flex; flex-direction: column; }
.summary-dog-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.summary-dog-row:last-child { border-bottom: none; }
.summary-no-dogs { margin-top: 8px; opacity: .45; }
.summary-notes { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── Dog edit button in table ────────────────────────────────────────────── */
.dog-edit-cell { width: 40px; padding: 0 8px !important; }
.dog-edit-btn { opacity: 0; background: none; border: none; cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 4px; transition: opacity .15s; color: var(--text-muted); }
.detail-table tbody tr:hover .dog-edit-btn { opacity: 1; }
.dog-edit-btn:hover { background: var(--bg); color: var(--text); }

/* ── THEMES ──────────────────────────────────────────────────────────────── */

[data-theme="dark"] {
  --bg:            #141517;
  --surface:       #1E2025;
  --border:        #2E3138;
  --text:          #E8E6E0;
  --text-muted:    #8A8A90;
  --primary:       #F59E0B;
  --primary-hover: #D97706;
  --primary-light: #2A1F00;
  --danger:        #F87171;
  --danger-light:  #2D1515;
  --success:       #4ADE80;
  --success-light: #0D2416;
  --warning:       #FBBF24;
  --warning-light: #2A1F00;
  --charcoal:      #0D0E10;
  --charcoal-mid:  #181A1E;
  --shadow:        0 1px 4px rgba(0,0,0,.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,.5);
}
[data-theme="dark"] .stats-table tbody tr:hover td { background: #262830; }
[data-theme="dark"] .ios-track { background: #3a3a3a; }
[data-theme="dark"] .level-approved  { background: #2A1F00; color: #FACC15; border-color: #854D0E; }
[data-theme="dark"] .level-certified { background: #052E16; color: #4ADE80; border-color: #166534; }
[data-theme="dark"] .level-name-approved  { color: #FACC15; }
[data-theme="dark"] .level-name-certified { color: #4ADE80; }

[data-theme="forest"] {
  --bg:            #EDF2EB;
  --surface:       #FFFFFF;
  --border:        #C8D9C2;
  --text:          #1A2B1A;
  --text-muted:    #5A7055;
  --primary:       #2D7A3A;
  --primary-hover: #236030;
  --primary-light: #E0F0DF;
  --danger:        #C0392B;
  --danger-light:  #FDECEA;
  --success:       #1B8040;
  --success-light: #E5F5EB;
  --warning:       #8B6914;
  --warning-light: #FDF6E3;
  --charcoal:      #1A2B1A;
  --charcoal-mid:  #243524;
  --shadow:        0 1px 4px rgba(0,0,0,.1);
  --shadow-md:     0 4px 16px rgba(0,0,0,.15);
}
[data-theme="forest"] .level-approved  { background: #FEF9C3; color: #713F12; border-color: #FDE047; }
[data-theme="forest"] .level-certified { background: #DCFCE7; color: #14532D; border-color: #4ADE80; }
[data-theme="forest"] .level-name-approved  { color: #713F12; }
[data-theme="forest"] .level-name-certified { color: #14532D; }
[data-theme="forest"] #login-screen {
  background: linear-gradient(150deg, #1A2B1A 0%, #243524 50%, #0f1f0f 100%);
}

[data-theme="tactical"] {
  --bg:            #E8E5DC;
  --surface:       #F2EFE6;
  --border:        #C8C3B0;
  --text:          #1F1E17;
  --text-muted:    #6B6654;
  --primary:       #6B6C2A;
  --primary-hover: #565720;
  --primary-light: #EDECD4;
  --danger:        #8B2020;
  --danger-light:  #F8EAEA;
  --success:       #3A6B2A;
  --success-light: #E5EED8;
  --warning:       #8B5E14;
  --warning-light: #F5ECD8;
  --charcoal:      #2C2B1E;
  --charcoal-mid:  #3A3928;
  --shadow:        0 1px 4px rgba(0,0,0,.12);
  --shadow-md:     0 4px 16px rgba(0,0,0,.18);
}
[data-theme="tactical"] .level-approved  { background: #FEF9C3; color: #713F12; border-color: #FDE047; }
[data-theme="tactical"] .level-certified { background: #DCFCE7; color: #14532D; border-color: #4ADE80; }
[data-theme="tactical"] .level-name-approved  { color: #713F12; }
[data-theme="tactical"] .level-name-certified { color: #14532D; }
[data-theme="tactical"] #login-screen {
  background: linear-gradient(150deg, #2C2B1E 0%, #3A3928 50%, #1a1a0a 100%);
}
[data-theme="tactical"] body {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: .01em;
}

/* ── THEME SWITCHER ──────────────────────────────────────────────────────── */
.theme-switcher {
  position: fixed; bottom: 18px; right: 18px; z-index: 9000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.theme-toggle-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--charcoal); color: #fff; border: none; cursor: pointer;
  font-size: 18px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.theme-toggle-btn:hover { transform: scale(1.1); }
.theme-palette {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.theme-palette.hidden { display: none !important; }
.theme-swatch {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 20px; padding: 5px 12px 5px 8px;
  font-size: 12px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow); transition: border-color .15s;
  white-space: nowrap;
}
.theme-swatch:hover { border-color: var(--primary); }
.theme-swatch.active { border-color: var(--primary); background: var(--primary-light); }
.swatch-dot {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,.15);
}

/* ── THEME: MODERN (inspired by clean finance UI) ────────────────────────── */
[data-theme="modern"] {
  --bg:            #F2EFE9;
  --surface:       #FFFFFF;
  --border:        #EDE9E2;
  --text:          #181614;
  --text-muted:    #9E9790;
  --primary:       #E07B00;
  --primary-hover: #C96E00;
  --primary-light: #FFF0DC;
  --danger:        #D63030;
  --danger-light:  #FEF0F0;
  --success:       #2A8050;
  --success-light: #EDFAF3;
  --warning:       #D97706;
  --warning-light: #FFF7ED;
  --charcoal:      #1C1410;
  --charcoal-mid:  #2E200F;
  --radius:        14px;
  --shadow:        0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.06);
  --shadow-md:     0 4px 20px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
}

/* Login */
[data-theme="modern"] #login-screen {
  background: linear-gradient(160deg, #1C1410 0%, #3D200A 55%, #E07B00 100%);
}
[data-theme="modern"] .login-box {
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  padding: 40px 36px;
}

/* App header — warm light */
[data-theme="modern"] .app-header {
  background: #e3ddd2;
  border-bottom: 1px solid #cec8bf;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
[data-theme="modern"] .header-title { color: var(--text); letter-spacing: .06em; }
[data-theme="modern"] .header-logo-img { filter: none; }
[data-theme="modern"] .header-user { color: var(--text-muted); }
[data-theme="modern"] #btn-logout,
[data-theme="modern"] #btn-manage,
[data-theme="modern"] #btn-profile { color: var(--text-muted); border-color: #cec8bf; }

/* Toolbar */
[data-theme="modern"] .toolbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}

/* Training list panel — теперь переопределено в bento-блоке ниже */
[data-theme="modern"] .tlist-item {
  border-radius: 10px;
  margin: 2px 8px;
  border: 1px solid transparent;
}
[data-theme="modern"] .tlist-item:hover { background: #F7F4EF; border-color: var(--border); }
[data-theme="modern"] .tlist-item.selected { background: #F7F4EF; border-left: 3px solid var(--success); padding-left: 9px; }

/* Training detail panel */
[data-theme="modern"] .training-detail-panel { background: var(--bg); }
[data-theme="modern"] .detail-header {
  background: #fff;
  margin: 16px 16px 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: none;
}
[data-theme="modern"] .detail-table-wrap { padding: 16px; }
[data-theme="modern"] .detail-table {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: none;
}
[data-theme="modern"] .detail-table thead th {
  background: #fff;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
[data-theme="modern"] .detail-table tbody tr:last-child td { border-bottom: none; }

/* Buttons */
[data-theme="modern"] .btn-primary {
  border-radius: 50px;
  font-weight: 600;
  letter-spacing: .03em;
}
[data-theme="modern"] .btn-outline {
  border-radius: 50px;
}

/* Mobile cards */
[data-theme="modern"] .training-card {
  margin: 0 12px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
[data-theme="modern"] .cards-container {
  background: var(--bg);
  padding: 4px 0;
}
[data-theme="modern"] .card-header { border-radius: 16px 16px 0 0; }

/* Modal */
[data-theme="modern"] .modal {
  border-radius: 24px;
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
}

/* Bottom sheet */
[data-theme="modern"] .bottom-sheet {
  border-radius: 24px 24px 0 0;
}

/* Attendance popup */
[data-theme="modern"] .att-popup {
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

/* Detail header count */
[data-theme="modern"] .dh-yes-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
[data-theme="modern"] .dh-yes-lbl {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

/* ── THEME: DASHBOARD (clean white cards on gray bg, bright orange) ─────── */
[data-theme="dashboard"] {
  --bg:            #EBEBEB;
  --surface:       #FFFFFF;
  --border:        #E4E4E4;
  --text:          #141414;
  --text-muted:    #888888;
  --primary:       #F26420;
  --primary-hover: #D9550F;
  --primary-light: #FEF0E8;
  --danger:        #E03030;
  --danger-light:  #FEF0F0;
  --success:       #1E9E5E;
  --success-light: #E8F8F0;
  --warning:       #D97706;
  --warning-light: #FFF7ED;
  --charcoal:      #141414;
  --charcoal-mid:  #1E1E1E;
  --radius:        12px;
  --shadow:        none;
  --shadow-md:     0 4px 24px rgba(0,0,0,.08);
}

/* Login */
[data-theme="dashboard"] #login-screen {
  background: linear-gradient(135deg, #141414 0%, #2A2A2A 50%, #F26420 130%);
}
[data-theme="dashboard"] .login-box {
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,.14);
}

/* App header */
[data-theme="dashboard"] .app-header {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
[data-theme="dashboard"] .header-title { color: var(--text); }
[data-theme="dashboard"] .header-user  { color: var(--text-muted); }
[data-theme="dashboard"] #btn-logout,
[data-theme="dashboard"] #btn-manage,
[data-theme="dashboard"] #btn-profile { color: var(--text-muted); border-color: var(--border); }

/* Toolbar */
[data-theme="dashboard"] .toolbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
}

/* Training list panel */
[data-theme="dashboard"] .training-list-panel {
  background: #FFFFFF;
  border-right: 1px solid var(--border);
}
[data-theme="dashboard"] .tlist-item {
  border-radius: 10px;
  margin: 1px 8px;
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
}
[data-theme="dashboard"] .tlist-item:hover {
  background: var(--primary-light);
  border-color: transparent;
}
[data-theme="dashboard"] .tlist-item.selected {
  background: #F0F0F0;
  border-left: 3px solid #999;
  padding-left: 9px;
}

/* Training detail panel */
[data-theme="dashboard"] .training-detail-panel {
  background: var(--bg);
}
[data-theme="dashboard"] .detail-header {
  margin: 14px 14px 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: none;
}
[data-theme="dashboard"] .detail-table-wrap {
  padding: 10px 14px 14px;
}
[data-theme="dashboard"] .detail-table {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border) !important;
  box-shadow: none;
}
[data-theme="dashboard"] .detail-table thead th {
  background: #FAFAFA;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
  border-bottom: 1px solid var(--border);
}
[data-theme="dashboard"] .detail-table tbody tr:last-child td {
  border-bottom: none;
}
[data-theme="dashboard"] .detail-table tbody tr:hover td {
  background: #FAFAFA;
}

/* Buttons — pill shape like in screenshot */
[data-theme="dashboard"] .btn-primary {
  border-radius: 50px;
  font-weight: 600;
}
[data-theme="dashboard"] .btn-outline {
  border-radius: 50px;
  border-color: var(--border);
  color: var(--text);
  background: #fff;
}
[data-theme="dashboard"] .btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
[data-theme="dashboard"] .btn-ghost { color: var(--text-muted); }

/* iOS toggle — orange when on */
[data-theme="dashboard"] .ios-toggle.on .ios-thumb { background: #fff; }

/* Mobile cards */
[data-theme="dashboard"] .cards-container {
  background: var(--bg);
  padding: 4px 0;
}
[data-theme="dashboard"] .training-card {
  margin: 0 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

/* Status badges in table — outlined pill style */
[data-theme="dashboard"] .cancelled-badge {
  border-radius: 50px;
  padding: 2px 10px;
  font-size: 10px;
}

/* Modal */
[data-theme="dashboard"] .modal {
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,.12);
}

/* Bottom sheet */
[data-theme="dashboard"] .bottom-sheet {
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
}

/* Subtype tags */
[data-theme="dashboard"] .subtype-tag {
  border-radius: 50px;
  font-size: 10px;
  padding: 2px 8px;
}

/* Select */
[data-theme="dashboard"] .select-sm {
  border-radius: 50px;
  border-color: var(--border);
}

/* Type badge */
[data-theme="dashboard"] .type-badge {
  background: var(--primary-light);
  color: var(--primary);
  border: none;
}

/* ── MODAL OVERRIDES: dashboard theme ───────────────────────────────────── */
[data-theme="dashboard"] .modal {
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,.14);
  overflow: hidden;
}
[data-theme="dashboard"] .modal-header {
  background: #FFFFFF;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}
[data-theme="dashboard"] .modal-header h2 {
  color: var(--text);
  font-size: 16px;
  letter-spacing: .04em;
}
[data-theme="dashboard"] .modal-close {
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
}
[data-theme="dashboard"] .modal-close:hover {
  background: var(--primary-light);
  color: var(--primary);
}
[data-theme="dashboard"] .modal-body { background: #FFFFFF; gap: 12px; }
[data-theme="dashboard"] .modal-body .field input,
[data-theme="dashboard"] .modal-body .field textarea,
[data-theme="dashboard"] .modal-body select {
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background-color: #FAFAFA;
  padding: 8px 36px 8px 16px;
  transition: border-color .15s, background-color .15s;
}
[data-theme="dashboard"] .modal-body .field textarea { border-radius: 12px; }
[data-theme="dashboard"] .modal-body .field input:focus,
[data-theme="dashboard"] .modal-body .field textarea:focus,
[data-theme="dashboard"] .modal-body select:focus {
  border-color: #777;
  background-color: #FFFFFF;
  outline: none;
}
[data-theme="dashboard"] .modal-body .field label {
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Att-popup */
[data-theme="dashboard"] .att-popup {
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
[data-theme="dashboard"] .att-popup-header {
  background: var(--primary);
  border-radius: 15px 15px 0 0;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 8px 12px;
}
[data-theme="dashboard"] .att-comment-row input,
[data-theme="dashboard"] .att-comment-row textarea {
  border-radius: 50px;
  border-color: var(--border);
  background: #FAFAFA;
}
[data-theme="dashboard"] .att-comment-row textarea { border-radius: 12px; }
[data-theme="dashboard"] .att-comment-row input:focus,
[data-theme="dashboard"] .att-comment-row textarea:focus { border-color: #888; background-color: #fff; }
[data-theme="dashboard"] .att-btn { border-radius: 50px; }

/* Bottom sheet */
[data-theme="dashboard"] .bottom-sheet {
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.10);
  border-top: 1px solid var(--border);
}
[data-theme="dashboard"] .bs-header { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 16px; letter-spacing: .02em; }
[data-theme="dashboard"] .bs-body .att-comment-row input,
[data-theme="dashboard"] .bs-body .att-comment-row textarea {
  border-radius: 50px;
  background: #FAFAFA;
}
[data-theme="dashboard"] .bs-body .att-comment-row textarea { border-radius: 12px; }

/* Manage modal tabs */
[data-theme="dashboard"] .manage-tab { border-radius: 50px; }
[data-theme="dashboard"] .manage-tab.active { background: var(--primary); color: #fff; }
[data-theme="dashboard"] .manage-item { border-radius: 10px; border: 1px solid var(--border); }
[data-theme="dashboard"] .manage-item:hover { border-color: var(--primary); background: var(--primary-light); }

/* ── MODAL OVERRIDES: modern theme ──────────────────────────────────────── */
[data-theme="modern"] .modal {
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
}
[data-theme="modern"] .modal-header {
  background: #e3ddd2;
  padding: 18px 22px;
  border-bottom: 1px solid #cec8bf;
}
[data-theme="modern"] .modal-header h2 { color: var(--text); }
[data-theme="modern"] .modal-close { color: var(--text-muted); }
[data-theme="modern"] .modal-close:hover {
  background: rgba(0,0,0,.08);
  color: var(--text);
}
[data-theme="modern"] .modal-body { gap: 10px; }
[data-theme="modern"] .modal-body .field input,
[data-theme="modern"] .modal-body .field textarea,
[data-theme="modern"] .modal-body select {
  border-radius: 10px;
  background-color: var(--bg);
  border-color: var(--border);
}
[data-theme="modern"] .modal-body .field input:focus,
[data-theme="modern"] .modal-body .field textarea:focus,
[data-theme="modern"] .modal-body select:focus {
  background-color: var(--surface);
  border-color: #777;
}
[data-theme="modern"] .att-popup {
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
}
[data-theme="modern"] .att-popup-header {
  background: #e3ddd2;
  color: var(--text);
  border-radius: 17px 17px 0 0;
  border-bottom: 1px solid #cec8bf;
}
[data-theme="modern"] .bottom-sheet { border-radius: 24px 24px 0 0; }
[data-theme="modern"] .manage-item { border-radius: 12px; }

/* ── tlist-toolbar theme overrides ──────────────────────────────────────── */
[data-theme="dashboard"] .tlist-toolbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
}
[data-theme="dashboard"] .tlist-toolbar .select-sm {
  background-color: #FAFAFA; color: var(--text); border-color: var(--border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dashboard"] .tlist-toolbar .select-sm option { background: #fff; color: var(--text); }
[data-theme="dashboard"] .tlist-toolbar-title { color: var(--text); }
[data-theme="dashboard"] .tlist-toolbar .btn-ghost { color: var(--text-muted); border-color: var(--border); }
[data-theme="dashboard"] .tlist-toolbar .btn-ghost:hover { background: var(--primary-light); color: var(--primary); }

/* ── Modern: bento left column ──────────────────────────────────────────── */
[data-theme="modern"] .tlist-column {
  background: transparent;
  border-right: none;
  padding: 16px 0 16px 8px;
  gap: 0;
  display: flex;
  flex-direction: column;
  /* Единая тень на весь белый блок (toolbar + list = одна форма) */
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.10));
}

[data-theme="modern"] .tlist-toolbar {
  background: #fff;
  border: none;
  border-radius: 14px 14px 0 0;
  height: auto;
  padding: 10px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid #e8e4de;
}
[data-theme="modern"] .tlist-toolbar-title { color: var(--text); }
[data-theme="modern"] .tlist-toolbar .select-sm {
  background-color: #F2EFE9;
  color: var(--text);
  border-color: #ddd9d2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="modern"] .tlist-toolbar .select-sm option { background: #f2efe9; color: var(--text); }
[data-theme="modern"] .tlist-toolbar .btn-ghost { color: var(--text-muted); border-color: #ddd9d2; }
[data-theme="modern"] .tlist-toolbar .btn-ghost:hover { background: rgba(0,0,0,.06); }

[data-theme="modern"] .training-list-panel {
  background: #fff;
  border: none;
  border-radius: 0 0 14px 14px;
  overflow-y: auto;
  flex: 1;
}

/* Тонкий скроллбар: 4px отступ справа, 4px сверху и снизу */
[data-theme="modern"] .training-list-panel::-webkit-scrollbar { width: 8px; }
[data-theme="modern"] .training-list-panel::-webkit-scrollbar-track { background: transparent; }
[data-theme="modern"] .training-list-panel::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.15);
  border-radius: 3px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 4px solid transparent;
  background-clip: content-box;
}
[data-theme="modern"] .training-list-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,.28);
  background-clip: content-box;
}

/* Dashboard: нейтральный focus без оранжевого */
[data-theme="dashboard"] input:focus,
[data-theme="dashboard"] textarea:focus,
[data-theme="dashboard"] select:focus {
  border-color: #888 !important;
  background-color: #fff !important;
  outline: none;
}
[data-theme="dashboard"] .bs-body .att-comment-row input:focus,
[data-theme="dashboard"] .bs-body .att-comment-row textarea:focus {
  border-color: #888 !important;
  background-color: #fff !important;
}
