:root {
  --odoo: #714B67;
  --odoo-dark: #4E3247;
  --odoo-soft: #F1E9EF;
  --teal: #017E84;
  --teal-soft: #E1F2F3;
  --daruma: #B71F19;
  --daruma-soft: #FBEAE9;
  --ok: #1E9E5A;
  --bg: #F5F3F5;
  --text: #2A2129;
  --muted: #756A73;
  --line: #E4DCE2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
code { background: var(--odoo-soft); color: var(--odoo-dark); padding: 1px 6px; border-radius: 5px; font-size: .88em; }

/* Capçalera: lila Odoo amb el vermell Daruma de fons */
.top {
  color: #fff;
  background:
    radial-gradient(ellipse at 100% 0%, rgba(183, 31, 25, .7), transparent 60%),
    linear-gradient(135deg, var(--odoo) 0%, var(--odoo-dark) 100%);
  padding: 26px 0 58px;
}
.top .wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo {
  width: 64px; height: 64px; flex: none;
  display: grid; place-items: center;
  background: #fff; border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.logo img { width: 48px; height: 48px; }
.title { flex: 1; min-width: 200px; }
.title h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.01em; }
.title p { margin: 2px 0 0; opacity: .8; }
.menu { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.menu form { margin: 0; }
.menu a, .menu button {
  color: #fff; text-decoration: none; font: inherit; font-weight: 600;
  padding: 8px 12px; border-radius: 9px; border: 0; background: transparent; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, .15); }
.menu button { border: 1px solid rgba(255, 255, 255, .3); }

main.wrap { position: relative; margin-top: -32px; padding-bottom: 24px; }
footer { color: var(--muted); font-size: .85rem; text-align: center; padding: 24px 20px 32px; }

/* Targetes i formularis */
.card {
  background: #fff; border-radius: 14px; padding: 20px 22px; margin: 0 0 20px;
  box-shadow: 0 8px 24px rgba(78, 50, 71, .1);
}
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; font-size: 1.25rem; color: var(--odoo-dark);
}
.card h2::before { content: ""; width: 5px; height: 22px; border-radius: 3px; background: var(--daruma); }
h3.sub { margin: 26px 0 6px; font-size: 1.05rem; color: var(--odoo-dark); }
.card.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.flash, .notice {
  background: #fff; border-radius: 12px; padding: 12px 16px; margin: 0 0 16px;
  border-left: 5px solid var(--odoo); box-shadow: 0 8px 24px rgba(78, 50, 71, .1);
}
.notice { border-left-color: var(--daruma); margin-top: 16px; }
.error { color: var(--daruma); background: var(--daruma-soft); padding: 10px 12px; border-radius: 9px; }

label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .9rem; color: var(--odoo-dark); }
input:not([type=checkbox]) {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-weight: 400; color: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
input:focus { outline: none; border-color: var(--odoo); box-shadow: 0 0 0 3px rgba(113, 75, 103, .18); }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--odoo); }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); margin-bottom: 10px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 200px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.actions form { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  background: var(--odoo); color: #fff; text-decoration: none; font: inherit; font-weight: 600;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover, .btn:focus-visible { background: var(--daruma); outline: none; }
.btn.ghost { background: #fff; color: var(--odoo); border-color: var(--line); }
.btn.ghost:hover { background: var(--odoo-soft); border-color: var(--odoo); }
.btn.danger { background: #fff; color: var(--daruma); border-color: #EBC7C5; }
.btn.danger:hover { background: var(--daruma); color: #fff; }

.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td a { color: var(--odoo); font-weight: 600; text-decoration: none; }
td a:hover { color: var(--daruma); }
td.right { text-align: right; white-space: nowrap; }
tr.off td { opacity: .55; }
table.creds input:not([type=checkbox]) { margin: 0; min-width: 160px; }
.tag {
  display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 2px 10px;
  color: var(--odoo); background: var(--odoo-soft);
}
.tag.admin { color: #fff; background: var(--odoo); }
.tag.none { color: var(--muted); background: #EFECEF; }

.grants { display: grid; gap: 14px; margin-top: 10px; }
.grant { border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px 6px; margin: 0; min-width: 0; }
.grant legend { padding: 0 6px; font-weight: 700; color: var(--odoo-dark); }
.grant legend .host { font-weight: 400; color: var(--muted); font-size: .85rem; margin-left: 6px; }
.dbs-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; padding-left: 4px; }
.dbs-check label.check { margin-bottom: 8px; overflow-wrap: anywhere; }

/* Panell: cerca, màquines i bases de dades */
.toolbar {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border-radius: 14px; padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(78, 50, 71, .14);
}
.toolbar input[type=search] {
  margin: 0; font-size: 1rem; padding-left: 42px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23714B67' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
}
.machines { display: grid; gap: 16px; margin-top: 24px; }
.machine {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; transition: box-shadow .15s, opacity .15s;
}
.machine:hover { box-shadow: 0 10px 24px rgba(78, 50, 71, .1); }
.machine.down { opacity: .6; }
.machine.down:hover { opacity: 1; }
.machine-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.ver {
  width: 50px; height: 50px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; background: var(--odoo);
  color: #fff; font-weight: 700; font-size: 1.35rem;
}
.ver.com { background: var(--teal); }
.machine-title { flex: 1; min-width: 180px; }
.machine-title h3 { margin: 0; font-size: 1.1rem; }
.host { margin: 0; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.machine-info { display: flex; align-items: center; gap: 14px; font-size: .8rem; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 3px rgba(30, 158, 90, .18);
}
.down .status { color: var(--muted); }
.down .status::before { box-shadow: none; }
.dbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px;
  padding: 14px 18px 18px;
}
.db {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 9px 9px 14px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem;
  transition: border-color .15s, background .15s;
}
.db .name { flex: 1; min-width: 0; overflow-wrap: break-word; }
.db .manual { display: block; margin-top: 1px; font-size: .72rem; font-weight: 500; color: var(--muted); }
.db .go {
  flex: none; padding: 5px 10px; border-radius: 7px;
  background: var(--odoo); color: #fff; font-size: .78rem;
  transition: background .15s;
}
.db:hover, .db:focus-visible { border-color: var(--odoo); background: var(--odoo-soft); outline: none; }
.db:hover .go, .db:focus-visible .go { background: var(--daruma); }
.note { margin: 0; padding: 14px 18px 18px; color: var(--muted); font-size: .9rem; }

@media (max-width: 560px) {
  .title h1 { font-size: 1.4rem; }
  .menu { width: 100%; }
}

/* Usuaris: taula d'accés amb perfils de permisos */
.small { font-size: .82rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.card-head h2 { margin: 0; }
.tag.ok { color: #13703F; background: #E3F4EA; }
.tag.bad { color: var(--daruma); background: var(--daruma-soft); }
.bad-text { color: var(--daruma); }
.error.small { margin: 4px 0 10px; }
select {
  font: inherit; color: inherit; width: 100%; min-width: 220px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
select:focus { outline: none; border-color: var(--odoo); box-shadow: 0 0 0 3px rgba(113, 75, 103, .18); }
table.access th, table.access td { padding: 7px 8px; }
table.access .tick { width: 34px; }
.db .manual.warn { color: var(--daruma); font-weight: 600; }

/* Pàgina «Entrant…» */
.entering { text-align: center; padding: 34px 26px; }
.entering h2 { justify-content: center; }
.entering h2::before { display: none; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid var(--odoo-soft); border-top-color: var(--daruma);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Triar amb quin usuari d'Odoo s'entra */
.choose { max-width: 640px; margin-left: auto; margin-right: auto; }
.who-list { display: grid; gap: 8px; margin: 16px 0 8px; }
.who {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.who:hover, .who:focus-visible { border-color: var(--odoo); background: var(--odoo-soft); outline: none; }
.who::after { content: "→"; margin-left: auto; color: var(--muted); }
.who:hover::after, .who:focus-visible::after { color: var(--daruma); }
.avatar {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700;
}
.avatar.admin { background: var(--odoo); }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text small { color: var(--muted); overflow-wrap: anywhere; }
