@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Serif+Display&display=swap');

:root {
  --red-dark:    #8a0c10;
  --red-main:    #cb1419;
  --red-light:   #e8343a;
  --red-pale:    #fdecea;
  --text:        #1a1a1a;
  --text-mid:    #4a4a4a;
  --text-soft:   #999;
  --border:      #e5e0e0;
  --bg:          #f7f4f4;
  --white:       #ffffff;
  --radius-lg:   14px;
  --radius-md:   10px;
  --radius-sm:   7px;
  --shadow-sm:   0 1px 4px rgba(100,0,0,.07);
  --shadow-md:   0 4px 16px rgba(100,0,0,.1);
  --shadow-lg:   0 8px 32px rgba(100,0,0,.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 1rem 1rem 3rem;
  min-height: 100vh;
}

.app { max-width: 660px; margin: 0 auto; }

.app-header {
  background: linear-gradient(135deg, #7a0c10 0%, var(--red-main) 60%, var(--red-light) 100%);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.app-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}
.app-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 21px;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: .01em;
  margin-bottom: 4px;
}
.app-header .sub {
  font-size: 12.5px;
  color: rgba(255,255,255,.7);
  margin: 0;
}
.header-logo {
  height: 34px;
  width: auto;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
  opacity: .92;
}

.section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow-sm);
}
.section:focus-within {
  box-shadow: 0 0 0 3px rgba(203,20,25,.08), var(--shadow-sm);
}
.stitle {
  font-size: 10px;
  font-weight: 700;
  color: var(--red-main);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .1em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stitle::before {
  content: '';
  display: inline-block;
  width: 3px; height: 14px;
  background: var(--red-main);
  border-radius: 2px;
  flex-shrink: 0;
}
.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-size: 11.5px;
  color: var(--text-mid);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.field .hint { font-size: 11px; color: var(--text-soft); margin-top: 3px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--red-main);
  box-shadow: 0 0 0 3px rgba(203,20,25,.1);
}
input:hover:not(:focus), select:hover:not(:focus) { border-color: #c09090; }
input.error { border-color: #e24b4a; background: #fff5f5; }
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 fill='none' stroke='%23cb1419' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
#typ-select {
  font-size: 14px;
  padding: 10px 30px 10px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  width: 100%;
  background-color: var(--white);
  color: var(--text);
}
.err-msg { font-size: 11px; color: #e24b4a; margin-top: 3px; display: none; }
.err-msg.show { display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.badge {
  font-size: 11px;
  padding: 3px 11px;
  border-radius: 20px;
  background: var(--red-pale);
  color: var(--red-dark);
  font-weight: 700;
  letter-spacing: .02em;
}
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: #d89090; box-shadow: var(--shadow-sm); }
.card-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.card-meta { font-size: 11px; color: var(--text-soft); margin-top: 3px; line-height: 1.6; }
.card-typ {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--red-pale);
  color: var(--red-dark);
  font-weight: 700;
  margin-bottom: 5px;
  display: inline-block;
  letter-spacing: .03em;
}
.card-hlavni { font-size: 13.5px; font-weight: 700; color: var(--text); margin-top: 3px; line-height: 1.5; }
.del { background: none; border: none; color: #ccc; cursor: pointer; font-size: 14px; padding: 3px 7px; border-radius: var(--radius-sm); transition: color .15s, background .15s; }
.del:hover { color: #e24b4a; background: #fef2f2; }
.btn-add {
  width: 100%;
  padding: 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  margin-top: 6px;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-add:hover { background: var(--red-pale); border-color: var(--red-light); color: var(--red-dark); }
.btn-exp {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-main) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(160,0,0,.25);
  transition: opacity .15s, transform .1s, box-shadow .15s;
  letter-spacing: .02em;
}
.btn-exp:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(160,0,0,.3); }
.btn-exp:active { transform: translateY(0); }
.btn-exp:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-reset {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-reset:hover { background: #fef2f2; color: var(--red-dark); border-color: #f5c6c6; }
.form-box {
  background: var(--white);
  border: 2px solid var(--red-main);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  box-shadow: 0 0 0 4px rgba(203,20,25,.06), var(--shadow-md);
}
.form-box-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--red-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-box-title::before {
  content: '✎';
  font-size: 13px;
  background: var(--red-pale);
  color: var(--red-main);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.note { font-size: 11px; color: var(--text-mid); margin-top: 8px; padding: 7px 10px; background: #fff8f8; border-radius: var(--radius-sm); line-height: 1.5; border-left: 3px solid var(--red-light); }
.note.warn { background: #fff8e6; color: #854F0B; border-color: #FAC775; }
.empty { font-size: 13px; color: var(--text-soft); text-align: center; padding: 1.5rem 0; }
.edit-btn {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
  cursor: pointer;
  font-size: 13px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  transition: color .15s, border-color .15s, background .15s;
  font-family: inherit;
}
.edit-btn:hover { color: var(--red-main); border-color: var(--red-main); background: var(--red-pale); }
.card-editing { border-color: var(--red-main) !important; background: var(--red-pale) !important; box-shadow: 0 0 0 3px rgba(203,20,25,.08) !important; }
.sep { height: 1px; background: var(--border); margin: 10px 0; }
.typ-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.subtyp-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.typ-btn { padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--white); font-size: 13px; cursor: pointer; text-align: left; color: var(--text); line-height: 1.4; transition: all .15s; font-family: inherit; }
.typ-btn:hover { border-color: var(--red-light); background: var(--red-pale); color: var(--red-dark); }
.typ-btn.active { border-color: var(--red-main); background: var(--red-pale); color: var(--red-dark); font-weight: 700; }
.typ-btn .typ-cat { font-size: 10px; color: var(--text-soft); display: block; margin-bottom: 2px; font-weight: 400; }
.typ-btn.active .typ-cat { color: var(--red-light); }
.subtyp-btn { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); font-size: 12px; cursor: pointer; text-align: center; color: var(--text-mid); transition: all .15s; font-family: inherit; }
.subtyp-btn:hover { border-color: var(--red-light); color: var(--red-dark); }
.subtyp-btn.active { border-color: var(--red-main); background: var(--red-pale); color: var(--red-dark); font-weight: 700; }

.btn-pdf {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  background: var(--white);
  color: var(--red-main);
  border: 2px solid var(--red-main);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  letter-spacing: .02em;
}
.btn-pdf:hover { background: var(--red-pale); }
.btn-pdf:disabled { opacity: .35; cursor: not-allowed; }
