:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #66717f;
  --line: #e2e5e9;
  --line-strong: #d4d9df;
  --accent: #1f4e73;
  --accent-soft: #eaf3fb;
  --danger: #b42318;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
}

.login-card {
  width: min(430px, 100%);
  margin: 7vh auto 0;
  padding: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 22px;
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
}

.brand-subtitle,
.client-name,
.security-note {
  color: var(--muted);
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 600;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 12px 13px;
  outline: none;
  background: white;
}

input:focus {
  border-color: #4b8fbd;
  box-shadow: 0 0 0 3px rgba(75, 143, 189, .12);
}

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 15px;
  background: var(--accent);
  color: white;
  font-weight: 650;
  cursor: pointer;
}

button:disabled {
  opacity: .55;
  cursor: default;
}

button.secondary,
.nav-button {
  background: white;
  color: var(--accent);
  border: 1px solid var(--line-strong);
}

.message {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.security-note {
  margin: 18px 0 0;
  font-size: 13px;
}

.hidden { display: none !important; }

.hub {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px;
}

.explorer-card {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
}

.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}

.nav-button {
  width: 38px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.breadcrumb {
  min-width: 0;
  flex: 1;
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  color: #30363d;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.explorer-message {
  margin: 8px 14px 0;
}

.explorer-table-wrap {
  overflow-x: auto;
}

.explorer-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.explorer-table th {
  height: 34px;
  padding: 0 10px;
  text-align: left;
  font-weight: 500;
  color: #505a66;
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid #eceef1;
  background: #fafbfc;
  white-space: nowrap;
}

.explorer-table th:last-child { border-right: 0; }

.explorer-table td {
  height: 36px;
  padding: 3px 10px;
  border-bottom: 1px solid #f0f1f3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.explorer-table tbody tr {
  cursor: default;
}

.explorer-table tbody tr:hover {
  background: #f3f7fb;
}

.explorer-table tbody tr.selected {
  background: #e6f0fa;
  outline: 1px solid #9bc2e2;
  outline-offset: -1px;
}

.name-col { width: 47%; }
.date-col { width: 20%; }
.type-col { width: 23%; }
.size-col { width: 10%; text-align: right !important; }

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: block;
}

.file-link {
  color: inherit;
  text-decoration: none;
}

.file-link:hover .file-label {
  text-decoration: underline;
}

.size-cell {
  text-align: right;
  color: #4d5864;
}

.muted-cell {
  color: #5e6975;
}

.empty-row td {
  padding: 34px 12px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 16px, 1180px);
    padding-top: 18px;
  }

  .date-col,
  .type-col,
  .explorer-table td:nth-child(2),
  .explorer-table td:nth-child(3) {
    display: none;
  }

  .name-col { width: 78%; }
  .size-col { width: 22%; }

  .explorer-table th,
  .explorer-table td {
    padding-left: 8px;
    padding-right: 8px;
  }
}


.toolbar-hint {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .toolbar-hint { display: none; }
}


/* Header Hub cliente */
.hub-header {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  padding: 10px 4px 14px;
}

.client-brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-logo-fallback {
  width: 150px;
  min-height: 54px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: .02em;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.client-company-block { min-width: 0; }

.client-company-name {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-company-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.hub-center-brand {
  text-align: center;
  padding: 0 18px;
}

.provider-brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.provider-logo {
  display: block;
  width: 188px;
  max-width: 24vw;
  height: 58px;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refresh-button { white-space: nowrap; }

/* Assistenza */
.hub-support {
  margin-top: 4px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.hub-support-title {
  font-weight: 700;
  margin-bottom: 3px;
}

.hub-support-text {
  color: var(--muted);
  font-size: 13px;
}

.support-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.support-button:hover {
  background: #f7f9fb;
}

@media (max-width: 900px) {
  .hub-header {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .hub-center-brand {
    order: -1;
    text-align: left;
    padding: 0;
  }

  .provider-brand-block {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .provider-logo {
    width: 150px;
    max-width: 48vw;
  }

  .client-logo-fallback {
    width: 125px;
  }
}

@media (max-width: 560px) {
  .client-brand-block {
    align-items: flex-start;
  }

  .client-logo-fallback {
    width: 108px;
    min-height: 48px;
    font-size: 10px;
  }

  .client-company-name {
    font-size: 16px;
  }

  .provider-brand-block,
  .hub-support {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button,
  .support-button {
    flex: 1;
  }
}


/* Rifinitura v2: testata più pulita e footer in fondo */
.hub {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 94px);
  gap: 18px;
}

.client-brand-block {
  flex: 1 1 0;
}

.client-name-accessible {
  display: none;
}

.client-logo-fallback {
  width: 180px;
  min-height: 58px;
  padding: 8px 14px;
  font-size: 12px;
}

.provider-brand-block {
  flex: 1 1 0;
}

.provider-logo {
  width: 255px;
  max-width: 28vw;
  height: 72px;
  object-fit: contain;
}

.hub-support-footer {
  margin-top: auto;
  padding: 10px 4px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.support-link {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.support-link:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .provider-logo {
    width: 220px;
    max-width: 58vw;
    height: 66px;
  }

  .hub-support-footer {
    flex-direction: row;
    align-items: center;
  }
}

@media (max-width: 560px) {
  .client-logo-fallback {
    width: 130px;
    min-height: 50px;
  }

  .provider-logo {
    width: 200px;
    max-width: 72vw;
    height: 62px;
  }

  .hub-support-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
