/* ==========================================================================
   Baufens Portal – admin panel
   ========================================================================== */

body.admin { background: var(--bg); }

/* ------------------------------ Prijava --------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 30px 26px;
  text-align: center;
}
.login-card__logo { height: 38px; width: auto; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.login-card p { margin: 0 0 18px; font-size: 14px; }
.login-card .field { text-align: left; }
.login-card__back { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--muted); text-decoration: none; }
.login-card__back:hover { color: var(--ink); }

/* ------------------------------ Traka ----------------------------------- */

.admin-bar {
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-bar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.admin-bar__brand { display: flex; align-items: center; gap: 12px; }
.admin-bar__brand img {
  height: 30px; width: auto; display: block;
  background: #fff; padding: 5px 8px; border-radius: 8px;
}
.admin-bar__brand strong { display: block; font-size: 15px; }
.admin-bar__brand small { color: rgba(255, 255, 255, .7); font-size: 12px; }
.admin-bar__actions { display: flex; align-items: center; gap: 8px; }
.admin-bar .btn--ghost { background: rgba(255, 255, 255, .10); border-color: rgba(255, 255, 255, .22); color: #fff; }
.admin-bar .btn--ghost:hover { background: rgba(255, 255, 255, .2); }

.admin-main { padding: 28px 20px 70px; }

/* ------------------------------ Kartice --------------------------------- */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 22px;
}
.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card__head h2 { margin: 0 0 2px; font-size: 18px; letter-spacing: -.01em; }
.card__head p { margin: 0; font-size: 13.5px; }
.card--danger-zone { border-color: #f2d5d2; background: #fffbfa; }

/* ------------------------------ Tabela ---------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
form.inline { display: inline-block; margin: 0; }
.table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid #eef2f1; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-hidden td { opacity: .55; }
.col-order { width: 46px; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-actions .btn, .col-actions form { margin-left: 4px; }

.order-btns { display: flex; flex-direction: column; gap: 2px; }
.mini {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 6px;
  width: 26px; height: 20px;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.mini:hover:not(:disabled) { background: #eef4f3; }
.mini:disabled { opacity: .35; cursor: not-allowed; }

.app-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.app-cell .app-icon { width: 40px; height: 40px; border-radius: 11px; }
.app-cell .app-icon .pi { width: 20px; height: 20px; }
.app-cell .app-icon--emoji { font-size: 20px; }
.app-cell strong { font-size: 15px; }

.chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef3f2;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

/* ------------------------------ Forme ----------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field--full { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="file"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d7e0df;
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8fbcb6; box-shadow: 0 0 0 4px rgba(13, 148, 136, .10); }
input[type="file"] { padding: 8px 10px; background: #fafcfc; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
.check input { width: auto; }

.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }

.color-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
input[type="color"] { width: 54px; height: 40px; padding: 3px; border: 1px solid #d7e0df; border-radius: 10px; background: #fff; cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d7e0df;
  background: var(--sw);
  cursor: pointer;
  padding: 0;
}
.swatch:hover { transform: scale(1.08); }

.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview { height: 40px; width: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: #fff; }

/* ------------------------------ Alerti ---------------------------------- */

.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert--ok { background: #e9f8f1; border-color: #bde5d3; color: #0f6b48; }
.alert--error { background: #fdecea; border-color: #f6c9c4; color: #9a271c; }
.alert--warn { background: #fef6e7; border-color: #f4ddb0; color: #8a5a0b; }
.alert code { background: rgba(0, 0, 0, .06); padding: 1px 5px; border-radius: 5px; }
.alert a { color: inherit; }

/* ------------------------------ Modal ----------------------------------- */

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 24px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal__backdrop { position: fixed; inset: 0; background: rgba(9, 26, 25, .5); backdrop-filter: blur(2px); }
.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  margin: auto;
  overflow: hidden;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal__head h3 { margin: 0; font-size: 18px; }
.modal__close { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal__close:hover { color: var(--ink); }
.modal__body { padding: 22px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: #fafcfc; }

/* ------------------------------ Tabovi + ikone -------------------------- */

.tabs { display: inline-flex; gap: 4px; background: #f1f5f4; border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.tab { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.tab.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.icon-pick {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, transform .15s;
}
.icon-pick:hover { border-color: #b9cdca; color: var(--ink); transform: translateY(-1px); }
.icon-pick.is-selected { border-color: var(--accent); color: var(--accent); background: #eef8f6; box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 10px; }
.emoji-pick {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.emoji-pick:hover { border-color: #b9cdca; background: #f7fbfa; }
.emoji-pick.is-selected { border-color: var(--accent); background: #eef8f6; box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }
.emoji-input { max-width: 140px; font-size: 20px; }

/* ------------------------------ Pregled --------------------------------- */

.preview { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 16px; }
.preview__card {
  display: flex; align-items: center; gap: 14px;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfd;
}
.preview__card .status-badge { margin-left: auto; }
.preview__card .app-icon { --app-color: #2563eb; }

.admin-foot { margin-top: 10px; text-align: right; }

@media (max-width: 640px) {
  .col-actions { text-align: left; }
  .modal { padding: 10px; }
  .modal__dialog { border-radius: 14px; }
}
