/* App-Styles auf Basis von myi.css (MYI Design System). Nur Tokens daraus, keine eigenen Farben. */

body.myi { min-height: 100vh; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--myi-gradient-dark);
  color: var(--myi-white);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 20px var(--myi-pad-page);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 14px; }
.brand-logo { font-weight: 900; font-size: 26px; letter-spacing: -.02em; }
.brand-sub { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--myi-accent-fg); }
.user-box { display: flex; align-items: center; gap: 12px; font-size: 14px; }

.page { max-width: 1280px; margin: 0 auto; padding: 32px var(--myi-pad-page) 80px; }

/* ---------- Stepper ---------- */
.stepper { display: flex; gap: 8px; margin: 0 0 28px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: var(--myi-radius-pill);
  border: 1px solid var(--myi-hairline); color: var(--myi-fg-muted);
  font-size: 14px; font-weight: 500; background: transparent; cursor: pointer;
  font-family: inherit;
}
.step .num {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 1px solid var(--myi-hairline); font-size: 12px; font-weight: 700;
}
.step.active { color: var(--myi-white); border-color: var(--myi-cyan); }
.step.active .num { background: var(--myi-cyan); color: var(--myi-black); border-color: var(--myi-cyan); }
.step.done { color: var(--myi-white); }
.step.done .num { background: var(--myi-blue); border-color: var(--myi-blue); color: var(--myi-white); }
.step:disabled { cursor: not-allowed; opacity: .6; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; gap: 18px 20px; grid-template-columns: repeat(12, 1fr); }
.col-12 { grid-column: span 12; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
@media (max-width: 800px) { .col-6, .col-4, .col-3, .col-2 { grid-column: span 12; } }

.field label {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 6px; color: rgba(24,24,24,.70);
}
.field .hint { font-size: 12px; color: rgba(24,24,24,.70); margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; font-size: 15px;
  padding: 11px 14px; border-radius: 8px;
  border: 1px solid rgba(24,24,24,.22); background: var(--myi-white); color: var(--myi-black);
}
.input:focus { outline: 2px solid var(--myi-blue); outline-offset: 0; border-color: var(--myi-blue); }
textarea.input { min-height: 90px; resize: vertical; }
.input.qty { width: 84px; padding: 7px 10px; text-align: right; }

.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--myi-blue); margin: 26px 0 14px;
}
.section-title:first-child { margin-top: 0; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 700; font-size: 14px; letter-spacing: .04em;
  padding: 12px 22px; border-radius: var(--myi-radius-pill); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--myi-cyan); color: var(--myi-black); }
.btn-blue { background: var(--myi-blue); color: var(--myi-white); }
.btn-ghost { background: transparent; color: var(--myi-white); border: 1px solid rgba(255,255,255,.4); }
.myi-card .btn-ghost { color: var(--myi-black); border-color: rgba(24,24,24,.3); }
.btn-small { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Kunden-Suche ---------- */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--myi-white); color: var(--myi-black);
  border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  max-height: 300px; overflow-y: auto; list-style: none; margin: 0; padding: 6px;
}
.combo-list li { padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo-list li small { color: rgba(24,24,24,.65); margin-left: 6px; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: rgba(47,91,232,.12); }
.selected-contact { margin-top: 8px; font-size: 14px; }
.selected-contact strong { color: var(--myi-blue); }

/* ---------- Material ---------- */
.material-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 1050px) { .material-layout { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { flex: 1 1 220px; width: auto; }
.toolbar label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }

.table-wrap { max-height: 62vh; overflow: auto; border-radius: 8px; border: 1px solid rgba(24,24,24,.10); }
.mat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mat-table th {
  position: sticky; top: 0; z-index: 2; background: var(--myi-white);
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(24,24,24,.70); padding: 10px 12px; border-bottom: 1px solid rgba(24,24,24,.14);
}
.mat-table td { padding: 9px 12px; border-bottom: 1px solid rgba(24,24,24,.08); vertical-align: middle; }
.mat-table td.num, .mat-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mat-table tr.folder-row td {
  background: rgba(47,91,232,.08); font-weight: 700; font-size: 12px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--myi-blue);
}
.mat-table tr.in-cart td { background: rgba(0,243,177,.14); }
.mat-name { font-weight: 500; }
.mat-code { font-size: 12px; color: rgba(24,24,24,.65); }
.free-zero { font-weight: 700; }
.tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--myi-radius-badge); margin-left: 6px; vertical-align: middle;
}
.tag-warn { background: var(--myi-yellow); color: var(--myi-black); }
.tag-info { background: rgba(24,24,24,.08); color: var(--myi-black); }

.cart { position: sticky; top: 16px; }
.cart ul { list-style: none; margin: 0; padding: 0; }
.cart li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(24,24,24,.08); font-size: 14px; }
.cart li:last-child { border-bottom: 0; }
.cart .remove { background: none; border: 0; color: var(--myi-blue); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; }
.cart-empty { font-size: 14px; color: rgba(24,24,24,.70); }
.cart-summary { display: flex; justify-content: space-between; font-weight: 700; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(24,24,24,.14); }

/* ---------- Übersicht ---------- */
.summary-grid { display: grid; grid-template-columns: 200px 1fr; gap: 10px 20px; font-size: 15px; }
.summary-grid dt { font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: rgba(24,24,24,.70); padding-top: 3px; }
.summary-grid dd { margin: 0; }

/* ---------- Meldungen ---------- */
.notice { border-radius: 8px; padding: 14px 18px; font-size: 14px; margin: 14px 0; }
.notice-warn { background: var(--myi-yellow); color: var(--myi-black); }
.notice-error { background: var(--myi-black); color: var(--myi-white); border: 2px solid var(--myi-yellow); }
.notice-info { background: rgba(47,91,232,.10); color: var(--myi-black); }
.hidden { display: none !important; }

.loading { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; }
.login-head { text-align: center; margin-bottom: 26px; }
.login-head .brand-logo { font-size: 40px; display: block; }

.success-big { font-size: 28px; font-weight: 700; margin: 0 0 8px; }

/* ---------- CI: Hintergründe und Logo aus dem MYI-Folienmaster ---------- */
body.app-bg {
  background: var(--myi-black) url('/assets/bg-dark.jpg') center / cover fixed no-repeat;
}
body.login-bg {
  /* Gradient-Artwork mit gerechnetem Schleier (52 % Thamar Black), damit weisser Text trägt */
  background:
    linear-gradient(rgba(24,24,24,.52), rgba(24,24,24,.52)),
    url('/assets/bg-blobs.jpg') center / cover fixed no-repeat;
  color: var(--myi-white);
}
.topbar { background: rgba(24,24,24,.72); backdrop-filter: blur(10px); border-bottom: 1px solid var(--myi-hairline); position: sticky; top: 0; z-index: 30; }
.logo { height: 34px; width: auto; border-radius: 0; display: block; }
.login-head .logo { height: 64px; margin: 0 auto 10px; }
.page-title { margin: 0 0 6px; }
.page-lead { margin: 0 0 26px; color: var(--myi-fg-muted); max-width: 720px; }
.mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; justify-content: center; }
.center { text-align: center; }
.mt-18 { margin-top: 18px; }

/* ---------- Navigation ---------- */
.main-nav { display: flex; gap: 6px; flex: 1; justify-content: center; flex-wrap: wrap; }
.nav-link {
  color: var(--myi-fg-muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--myi-radius-pill);
}
.nav-link:hover { color: var(--myi-white); background: rgba(255,255,255,.08); }
.nav-link.active { color: var(--myi-black); background: var(--myi-cyan); font-weight: 700; }
@media (max-width: 900px) { .topbar-inner { flex-wrap: wrap; } .main-nav { order: 3; flex-basis: 100%; justify-content: flex-start; } }

/* ---------- Benutzerverwaltung ---------- */
.admin-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1050px) { .admin-layout { grid-template-columns: 1fr; } }
.temp-pw {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--myi-black); color: var(--myi-cyan); border-radius: 8px;
  padding: 14px 16px; margin: 12px 0; font-size: 20px; font-weight: 700; letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.temp-pw .btn { flex: none; }
.user-table td { vertical-align: top; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.link-btn {
  background: none; border: 1px solid rgba(24,24,24,.22); border-radius: var(--myi-radius-pill);
  padding: 5px 11px; font: inherit; font-size: 12px; font-weight: 500; color: var(--myi-black); cursor: pointer; white-space: nowrap;
}
.link-btn:hover { border-color: var(--myi-blue); color: var(--myi-blue); }
.link-btn.danger:hover { border-color: var(--myi-black); background: var(--myi-black); color: var(--myi-white); }
.tag-admin { background: var(--myi-blue); color: var(--myi-white); }
.tag-ok { background: var(--myi-cyan); color: var(--myi-black); }
.tag-off { background: var(--myi-black); color: var(--myi-white); }
.pw-rules { font-size: 13px; margin: 6px 0 0; padding-left: 18px; color: rgba(24,24,24,.75); }
.pw-rules li.met { color: var(--myi-black); font-weight: 700; }
.narrow { max-width: 560px; }
.mt-8 { margin-top: 8px; }
.temp-pw span { font-size: 18px; white-space: nowrap; }
.user-table .tag { white-space: nowrap; }
a.link-btn { text-decoration: none; display: inline-block; }
.user-table td:first-child { min-width: 150px; }

/* ---------- Accountverwaltung: Dialog ---------- */
.radio-group { border: 0; padding: 0; margin: 0 0 4px; display: grid; gap: 8px; }
.radio-group legend {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 8px; color: rgba(24,24,24,.70); padding: 0;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--myi-blue); width: 16px; height: 16px; }
.mb-8 { margin-bottom: 8px; }
.edit-dialog { border: 0; padding: 0; background: transparent; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.edit-dialog::backdrop { background: rgba(24,24,24,.72); }
.edit-dialog .myi-card { margin: 0; }
.edit-dialog .section-title { margin-top: 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-x {
  background: none; border: 1px solid rgba(255,255,255,.5); color: var(--myi-white); border-radius: var(--myi-radius-pill);
  font: inherit; font-size: 12px; font-weight: 700; padding: 4px 12px; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.actions-tight { display: flex; justify-content: flex-end; gap: 8px; }
#ed-danger { margin-top: 8px; padding-top: 4px; border-top: 1px solid rgba(24,24,24,.10); }
select.input:disabled, .input:disabled { background: rgba(24,24,24,.05); color: rgba(24,24,24,.6); }
.myi-card { color-scheme: light; }
.field label.check, .radio-group label.check {
  display: flex; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400;
  color: var(--myi-black); margin: 0;
}
.edit-dialog { overflow: auto; }

/* ---------- Breite Seiten (Material, Bestellungen, Protokoll) ---------- */
.page.page-wide { max-width: 1560px; }
.topbar-inner { max-width: 1560px; }
.user-box .nav-link.small { font-size: 13px; padding: 6px 10px; }

/* ---------- Material: Baum | Liste | Auswahl ---------- */
.material-layout { grid-template-columns: 290px minmax(0, 1fr) 320px; }
@media (max-width: 1280px) { .material-layout { grid-template-columns: 250px minmax(0, 1fr); } .material-layout .cart { grid-column: 1 / -1; position: static; } }
@media (max-width: 800px) { .material-layout { grid-template-columns: 1fr; } }

.tree-card { position: sticky; top: 96px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; padding-bottom: 12px; }
.tree-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tree-tools { display: flex; gap: 6px; }
.tree-tool {
  background: none; border: 1px solid rgba(255,255,255,.5); color: var(--myi-white); border-radius: var(--myi-radius-pill);
  font: inherit; font-size: 11px; font-weight: 700; padding: 3px 9px; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.tree { overflow: auto; margin: 0 -8px; padding: 0 4px; flex: 1; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul[role="group"] { padding-left: 14px; border-left: 1px solid rgba(24,24,24,.10); margin-left: 11px; }
.tree-row { display: flex; align-items: center; gap: 2px; }
.tree-toggle, .tree-toggle-spacer { flex: none; width: 22px; height: 28px; }
.tree-toggle {
  border: 0; background: none; cursor: pointer; position: relative; border-radius: 6px;
}
.tree-toggle::before {
  /* Pfeil per CSS, Poppins hat keine Pfeilzeichen */
  content: ''; position: absolute; left: 8px; top: 10px; width: 6px; height: 6px;
  border-right: 2px solid var(--myi-blue); border-bottom: 2px solid var(--myi-blue);
  transform: rotate(-45deg); transition: transform .15s;
}
.tree-toggle.open::before { transform: rotate(45deg); top: 8px; }
.tree-toggle:hover { background: rgba(47,91,232,.10); }
.tree-label {
  flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border: 0; background: none; font: inherit; font-size: 14px; color: var(--myi-black); text-align: left;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
}
.tree-label:hover { background: rgba(47,91,232,.08); }
.tree-label.selected { background: var(--myi-blue); color: var(--myi-white); font-weight: 700; }
.tree-label.selected .tree-count { background: rgba(255,255,255,.22); color: var(--myi-white); }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count {
  flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--myi-radius-pill);
  background: rgba(24,24,24,.07); color: rgba(24,24,24,.75); font-variant-numeric: tabular-nums;
}
.tree-root > .tree-item > .tree-row .tree-label { font-weight: 700; }

.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; margin: -4px 0 10px; }
.crumb-link { border: 0; background: none; font: inherit; color: var(--myi-blue); cursor: pointer; padding: 0; text-decoration: underline; }
.crumb-sep { color: rgba(24,24,24,.45); }

/* ---------- Bestellungen und Protokoll ---------- */
.list-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.list-toolbar .input { width: auto; flex: 1 1 220px; }
.list-toolbar select.input { flex: 0 1 240px; }
.order { border: 1px solid rgba(24,24,24,.12); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.order > summary {
  list-style: none; cursor: pointer; display: grid; gap: 4px 18px; align-items: center; padding: 14px 18px;
  grid-template-columns: 22px minmax(200px, 2fr) minmax(140px, 1.2fr) minmax(190px, 1.4fr) 110px 130px;
}
.order > summary::-webkit-details-marker { display: none; }
.order > summary::before {
  content: ''; width: 7px; height: 7px; border-right: 2px solid var(--myi-blue); border-bottom: 2px solid var(--myi-blue);
  transform: rotate(-45deg); transition: transform .15s; justify-self: center;
}
.order[open] > summary::before { transform: rotate(45deg); }
.order[open] > summary { background: rgba(47,91,232,.06); border-bottom: 1px solid rgba(24,24,24,.10); }
.order-title { font-weight: 700; }
.order-meta { font-size: 12px; color: rgba(24,24,24,.70); }
.order-body { padding: 16px 18px 18px; }
.order-body .summary-grid { margin-bottom: 14px; grid-template-columns: 170px 1fr; font-size: 14px; }
@media (max-width: 900px) { .order > summary { grid-template-columns: 22px 1fr; } .order > summary > :nth-child(n+3) { grid-column: 2; } }
.empty-state { padding: 30px 10px; text-align: center; color: rgba(24,24,24,.70); }
.audit-table td { vertical-align: top; font-size: 13px; }
.audit-table td.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag-project { background: var(--myi-cyan); color: var(--myi-black); }
.more-row { text-align: center; margin-top: 12px; }
.link-inline { color: var(--myi-blue); }
a.btn { text-decoration: none; }
/* Links mit Button-Optik: Farbe des Buttons, nicht der Link-Farbe aus myi.css */
.myi a.btn.btn-blue, .myi a.btn.btn-blue:visited { color: var(--myi-white); }
.myi a.btn.btn-primary, .myi a.btn.btn-primary:visited { color: var(--myi-black); }
.myi .myi-card a.btn.btn-ghost { color: var(--myi-black); }
