:root {
  --pro-text: #111827;
  --pro-muted: #6b7280;
  --pro-surface: #ffffff;
  --pro-surface-elevated: #f3f4f6;
  --pro-border: rgba(17, 24, 39, 0.1);
  --pro-gold: #111111;
  --pro-gold-bright: #000000;
  --pro-bg: #f4f5f7;
  --sidebar-w: 240px;
  font-family: Inter, Segoe UI, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--pro-bg); color: var(--pro-text); min-height: 100vh; }
[hidden] { display: none !important; }

.boot {
  min-height: 100vh; display: grid; place-items: center;
  color: var(--pro-muted); font-size: .95rem;
}

/* ——— Login (comme P1P1) ——— */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #111; padding: 1.5rem 1rem;
}
.login-card {
  width: 100%; max-width: 28rem; background: #fff; border-radius: 1rem;
  padding: 2rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
  display: grid; gap: 1rem;
}
.login-brand { text-align: center; margin-bottom: .25rem; }
.login-brand h1 { margin: .5rem 0 0; font-size: 1.35rem; letter-spacing: -.02em; }
.login-brand p { margin: .35rem 0 0; color: var(--pro-muted); font-size: .875rem; }
.login-error { margin: 0; text-align: center; color: #b91c1c; font-size: .875rem; }
.login-submit {
  appearance: none; border: none; cursor: pointer; width: 100%;
  background: #111; color: #fff; font-weight: 600; font-size: .875rem;
  border-radius: .65rem; padding: .85rem 1rem;
}
.login-submit:hover { background: #000; }
.login-submit:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-block; padding: .28rem .55rem; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #fff; font-size: .68rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.login-card .badge { background: rgba(17,17,17,.08); color: #111; }

/* ——— App shell + sidebar ——— */
.app {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.pro-sidebar {
  background: #111111; color: #f4f4f5;
  border-right: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; min-height: 100vh;
  position: sticky; top: 0; height: 100vh;
}
.pro-sidebar__brand {
  padding: 1.1rem 1rem 1rem; display: grid; gap: .45rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.pro-sidebar__brand strong { font-size: .95rem; letter-spacing: -.01em; }
.pro-sidebar-nav {
  flex: 1; padding: .75rem .65rem; display: flex; flex-direction: column; gap: .25rem;
  overflow: auto;
}
.pro-nav-btn {
  display: inline-flex; width: 100%; align-items: center; gap: .625rem;
  border: none; border-radius: .5rem; padding: .5rem .75rem;
  background: transparent; font-size: .8125rem; font-weight: 500;
  color: rgba(255,255,255,.72); cursor: pointer; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.pro-nav-btn:hover { background: #1f1f1f; color: #fff; }
.pro-nav-btn.is-active {
  background: rgba(255,255,255,.14); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 2px 10px -4px rgba(0,0,0,.4);
}
.pro-nav-btn--logout { color: rgba(255,255,255,.55); font-size: .75rem; }
.pro-sidebar-account {
  margin-top: auto; padding: .85rem .65rem 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: grid; gap: .5rem;
}
.pro-sidebar-account__name {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8125rem; font-weight: 700; color: #fff;
}
.pro-sidebar-account__role { margin: .15rem 0 0; font-size: .75rem; color: rgba(255,255,255,.55); }

.pro-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.pro-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--pro-border);
  background: rgba(255,255,255,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.pro-header h1 { margin: 0; font-size: 1.15rem; letter-spacing: -.02em; }
.pro-content { padding: 1.25rem; max-width: 960px; width: 100%; }

.pro-btn-primary {
  appearance: none; border: none; cursor: pointer;
  background: var(--pro-gold); color: #fff; font-weight: 650; font-size: .875rem;
  border-radius: .65rem; padding: .55rem .9rem;
}
.pro-btn-primary:hover { background: var(--pro-gold-bright); }
.pro-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.pro-btn-secondary {
  appearance: none; cursor: pointer;
  border: 1px solid var(--pro-border); background: var(--pro-surface);
  color: var(--pro-text); font-weight: 600; font-size: .75rem;
  border-radius: .55rem; padding: .4rem .7rem;
}
.pro-btn-secondary:hover { background: var(--pro-surface-elevated); }
.pro-input {
  appearance: none; width: 100%; border: 1px solid var(--pro-border);
  background: #f9fafb; border-radius: .55rem; padding: .55rem .7rem; font-size: .9rem;
}
label { display: block; font-size: .875rem; }
label > span { display: block; margin-bottom: .3rem; font-weight: 550; color: var(--pro-muted); }

.card {
  border: 1px solid var(--pro-border); background: var(--pro-surface);
  border-radius: .9rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden;
}
.card + .card { margin-top: 1rem; }
.card__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
  border-bottom: 1px solid var(--pro-border); padding: 1rem 1.25rem;
}
.card__head h2 { margin: 0; font-size: 1rem; }
.card__head p { margin: .3rem 0 0; font-size: .75rem; color: var(--pro-muted); }
.form { display: grid; gap: 1rem; padding: 1.25rem; }
@media (min-width: 900px) { .form { grid-template-columns: 1fr 1fr; } .form .span2 { grid-column: 1 / -1; } }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.create-open-row { display: flex; justify-content: flex-end; margin: 1rem 0 .75rem; }
.pad { padding: 1.25rem; }
.muted { color: var(--pro-muted); font-size: .9rem; margin: 0; }
.alert { border-radius: .75rem; padding: .75rem 1rem; font-size: .875rem; margin-bottom: 1rem; }
.alert--err { border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; }
.alert--ok { border: 1px solid #a7f3d0; background: #ecfdf5; color: #065f46; }
.row {
  padding: 1rem 1.25rem; border-top: 1px solid var(--pro-border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
}
.row:first-child { border-top: 0; }
.row__name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; margin: 0; }
.row__meta { margin: .15rem 0 0; font-size: .875rem; color: var(--pro-muted); }
.empty { padding: 2rem; text-align: center; color: var(--pro-muted); font-size: .875rem; }
.danger {
  border: 1px solid #fecaca; color: #b91c1c; background: transparent;
  border-radius: .55rem; padding: .4rem .7rem; font-size: .75rem; cursor: pointer;
}
.danger:hover { background: #fef2f2; }

@media (max-width: 767px) {
  .app { grid-template-columns: 1fr; }
  .pro-sidebar {
    position: relative; height: auto; min-height: 0;
  }
  .pro-sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .pro-nav-btn { width: auto; }
}

.notice {
  border: 1px solid var(--pro-border); background: #fff;
  border-radius: .75rem; padding: .85rem 1rem; font-size: .875rem;
  margin-bottom: 1rem; color: var(--pro-muted);
}
.kpi-grid {
  display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}
.kpi-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi {
  border: 1px solid var(--pro-border); background: #fff;
  border-radius: .85rem; padding: .9rem 1rem;
}
.kpi__label { margin: 0; font-size: .72rem; color: var(--pro-muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { margin: .35rem 0 0; font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.kpi__value--sm { font-size: 1rem; }
.table-wrap { overflow-x: auto; }
.pro-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.pro-table th {
  text-align: left; padding: .75rem 1.1rem; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--pro-muted);
  border-bottom: 1px solid var(--pro-border);
}
.pro-table td { padding: .8rem 1.1rem; border-top: 1px solid var(--pro-border); vertical-align: middle; }
.pro-row--selectable { cursor: pointer; }
.pro-row--selectable:hover { background: var(--pro-surface-elevated); }
.pro-row--selectable.is-selected { background: rgba(17,17,17,.05); }
.linkish {
  appearance: none; border: 0; background: transparent; padding: 0;
  font: inherit; font-weight: 650; cursor: pointer; color: var(--pro-text);
  text-decoration: underline; text-underline-offset: 2px;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pill {
  display: inline-block; border-radius: 999px; padding: .15rem .55rem;
  font-size: .7rem; font-weight: 650; background: #f3f4f6; color: #374151;
}
.pill--on { background: #ecfdf5; color: #065f46; }
.pill--off { background: #fef2f2; color: #b91c1c; }
.card__head .search { max-width: 14rem; min-width: 10rem; }
.pro-content { max-width: 1100px; }

.drawer[hidden] { display: none !important; }
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(17,17,17,.35); }
.drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(420px, 100%);
  background: #fff; border-left: 1px solid var(--pro-border);
  box-shadow: -12px 0 40px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
}
.drawer__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.15rem; border-bottom: 1px solid var(--pro-border);
}
.drawer__eyebrow { margin: 0; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--pro-muted); font-weight: 700; }
.drawer__head h2 { margin: .25rem 0 0; font-size: 1.15rem; }
.drawer__sub { margin: .25rem 0 0; font-size: .8rem; color: var(--pro-muted); }
.drawer__body { padding: 1.15rem; overflow: auto; flex: 1; }
.sheet-hero { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; }
.avatar {
  width: 3.25rem; height: 3.25rem; border-radius: 999px; background: #111; color: #fff;
  display: grid; place-items: center; font-weight: 750; font-size: 1.15rem;
}
.sheet-name { margin: 0; font-weight: 750; font-size: 1.05rem; }
.sheet-dl {
  border: 1px solid var(--pro-border); border-radius: .85rem; overflow: hidden; margin: 1rem 0;
}
.sheet-dl > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem .9rem; border-top: 1px solid var(--pro-border); font-size: .875rem;
}
.sheet-dl > div:first-child { border-top: 0; }
.sheet-dl dt { color: var(--pro-muted); }
.sheet-dl dd { margin: 0; font-weight: 550; text-align: right; }
.sheet-form { display: grid; gap: .75rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.check input { width: auto; }

.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(17,17,17,.45); }
.modal__card {
  position: relative; width: min(420px, 100%); background: #fff; border-radius: 1rem;
  padding: 1.25rem; display: grid; gap: .75rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.35);
}
.modal__card h2 { margin: 0; font-size: 1.1rem; }

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .card__head { flex-direction: column; }
}

.pw-field { position: relative; display: block; }
.pw-field .pro-input { padding-right: 2.75rem; }
.pw-toggle {
  appearance: none; position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; width: 2rem; height: 2rem;
  border-radius: .45rem; color: var(--pro-muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M12 5c-7 0-10 7-10 7s3 7 10 7 10-7 10-7-3-7-10-7zm0 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10zm0-2.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 1.1rem;
}
.pw-toggle:hover { background-color: var(--pro-surface-elevated); color: var(--pro-text); }
.pw-toggle[aria-pressed="true"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23111827'%3E%3Cpath d='M2 4.3 4.3 2l18 18-2.3 2.3-3.2-3.2A12.5 12.5 0 0 1 12 19c-7 0-10-7-10-7a18.7 18.7 0 0 1 5.1-5.6L2 4.3zm10 2.7a5 5 0 0 1 4.9 6.1l-1.6-1.6A2.5 2.5 0 0 0 12.5 8.7L12 7zm0 10a5 5 0 0 1-4.9-6.1l1.6 1.6A2.5 2.5 0 0 0 11.5 15.3L12 17z'/%3E%3C/svg%3E");
}
