.gd-shell{
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.gd-fixed-header{
  position:sticky;
  top:0;
  z-index:12;
  flex:0 0 auto;
  background:var(--surface,#f4f8fd);
  border-bottom:1px solid var(--border-color,#dbe3ee);
}

.gd-toolbar{
  min-height:58px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:8px 0;
}

.gd-tabs{
  display:flex;
  align-items:center;
  gap:5px;
  padding:4px;
  flex:0 0 auto;
  border:1px solid var(--border-color,#dbe3ee);
  border-radius:13px;
  background:var(--surface-elevated,#fff);
}

.gd-tabs button,
.gd-new,
.gd-promote{
  min-height:34px;
  border:0;
  border-radius:9px;
  padding:7px 13px;
  font:inherit;
  cursor:pointer;
}

.gd-tabs button.active{
  font-weight:700;
  background:var(--surface-selected,#edf3fb);
  box-shadow:0 1px 5px rgba(15,35,60,.12);
}

.gd-tools{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex:1;
}

.gd-tools input{
  width:min(360px,100%);
  min-height:38px;
  padding:8px 12px;
  border:1px solid var(--border-color,#dbe3ee);
  border-radius:10px;
  background:var(--surface-elevated,#fff);
  color:inherit;
}

.gd-new{
  flex:0 0 auto;
  font-weight:600;
}

.gd-summary{
  min-height:34px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 0 8px;
  font-size:13px;
}

.gd-list-head,
.gd-row{
  display:grid;
  grid-template-columns:
    minmax(210px,1.7fr)
    minmax(90px,.65fr)
    minmax(160px,1.25fr)
    minmax(190px,1.4fr)
    minmax(80px,.55fr)
    minmax(90px,.65fr);
  gap:12px;
  align-items:center;
}

.gd-list-head{
  min-height:36px;
  padding:0 14px;
  font-size:11px;
  font-weight:700;
  opacity:.7;
  border-top:1px solid var(--border-color,#dbe3ee);
}

.gd-scroll-region{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}

.gd-list{
  display:block;
  min-width:0;
}

.gd-row{
  min-height:58px;
  padding:9px 14px;
  border-bottom:1px solid var(--border-color,#dbe3ee);
}

.gd-row:hover{
  background:rgba(120,150,190,.06);
}

.gd-cell{
  min-width:0;
  font-size:12px;
  overflow-wrap:anywhere;
}

.gd-name{
  display:grid;
  gap:3px;
}

.gd-name strong{
  font-size:13px;
}

.gd-name small{
  font-size:11px;
  opacity:.65;
}

.gd-contact{
  white-space:normal;
}

.gd-actions{
  display:flex;
  justify-content:flex-end;
}

.gd-badge{
  display:inline-flex;
  align-items:center;
  width:max-content;
  padding:3px 7px;
  border:1px solid currentColor;
  border-radius:999px;
  font-size:10px;
  line-height:1;
}

.gd-official{
  font-weight:700;
}

.gd-promote{
  min-height:30px;
  padding:5px 9px;
}

.gd-empty,
.gd-loading{
  padding:36px 20px;
  text-align:center;
  opacity:.7;
}

.gd-dialog{
  width:min(520px,calc(100vw - 28px));
  max-height:calc(100vh - 40px);
  border:0;
  border-radius:16px;
  padding:0;
}

.gd-dialog form{
  display:grid;
  gap:12px;
  padding:20px;
  overflow:auto;
}

.gd-dialog label{
  display:grid;
  gap:5px;
  font-size:12px;
}

.gd-dialog input,
.gd-dialog select{
  min-height:38px;
  padding:8px 10px;
  border:1px solid #ccd5e0;
  border-radius:9px;
}

.gd-dialog-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:8px;
}

@media(max-width:900px){
  .gd-list-head{
    display:none;
  }

  .gd-row{
    grid-template-columns:1fr 1fr;
    gap:8px 16px;
    padding:12px;
  }

  .gd-cell::before{
    content:attr(data-label);
    display:block;
    margin-bottom:2px;
    font-size:10px;
    font-weight:700;
    opacity:.55;
  }

  .gd-name{
    grid-column:1/-1;
  }

  .gd-actions{
    justify-content:flex-start;
  }
}

@media(max-width:640px){
  .gd-toolbar{
    align-items:stretch;
    flex-direction:column;
    gap:8px;
  }

  .gd-tabs{
    width:100%;
    overflow-x:auto;
  }

  .gd-tabs button{
    flex:1 0 auto;
  }

  .gd-tools{
    width:100%;
  }

  .gd-tools input{
    width:100%;
  }

  .gd-row{
    grid-template-columns:1fr;
  }

  .gd-cell{
    grid-column:1;
  }
}


/* OMNIA RUBRICA R5B.2 R4 */

.ms-nav-item[data-route="general-directory"] .gd-rubrica-icon{
  width:28px;
  height:28px;
  flex:0 0 28px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.ms-nav-item[data-route="general-directory"] .gd-rubrica-icon img{
  width:28px;
  height:28px;
  display:block;
  object-fit:contain;
  image-rendering:auto;
  filter:drop-shadow(0 3px 5px rgba(10,44,83,.26));
}

.gd-fixed-header{
  position:sticky;
  top:0;
  z-index:12;
}

.gd-canonical-toolbar-host{
  width:100%;
  min-width:0;
  flex:0 0 auto;
}

.gd-canonical-toolbar-host .ms-canonical-toolbar{
  width:100%;
}

.gd-tabs{
  flex:0 0 auto;
}

.gd-scroll-region{
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

/* OMNIA BUSINESS CARD SCANNER R6.1B */
.gd-scan-primary{
  display:flex;
  justify-content:flex-start;
  margin:.65rem 0;
}

.gd-scan-button{
  min-height:48px;
  padding:.7rem 1rem;
  border-radius:14px;
  font-weight:800;
  cursor:pointer;
}

.gd-card-provider-note{
  margin:.25rem 0 1rem;
  opacity:.8;
  line-height:1.4;
}

.gd-card-captures,
.gd-card-fields{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:.75rem 1rem;
}

.gd-card-captures{
  margin-bottom:1rem;
}

.gd-card-capture{
  display:grid;
  gap:.5rem;
}

.gd-card-capture img{
  display:block;
  width:100%;
  max-height:220px;
  object-fit:contain;
  border-radius:12px;
}

.gd-card-fields label{
  display:grid;
  gap:.35rem;
}

.gd-card-wide{
  grid-column:1/-1;
}

@media (max-width:720px){
  .gd-scan-primary{
    width:100%;
  }

  .gd-scan-button{
    width:100%;
    min-height:56px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.55rem;
    font-size:1rem;
  }

  .gd-card-captures,
  .gd-card-fields{
    grid-template-columns:1fr;
  }

  .gd-card-wide{
    grid-column:auto;
  }

  .gd-card-dialog{
    width:min(96vw,640px);
    max-height:92dvh;
    overflow:auto;
  }
}

/* OMNIA_R6_1E4_DIRECTORY_SELECTION */
.gd-row[data-gd-row] {
  cursor: pointer;
}

.gd-row[data-gd-row].selected {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}


/* OMNIA R6.1E8-R2 — explicit checkbox selection */

.gd-row.gd-selection-mode{
  grid-template-columns:
    38px
    minmax(210px,1.7fr)
    minmax(90px,.65fr)
    minmax(160px,1.25fr)
    minmax(190px,1.4fr)
    minmax(80px,.55fr)
    minmax(90px,.65fr);
}

.gd-select-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
}

.gd-select-checkbox{
  width:20px;
  height:20px;
  margin:0;
  cursor:pointer;
  accent-color:currentColor;
}

.gd-select-protected{
  font-size:9px;
  font-weight:800;
  opacity:.55;
}

.gd-row.selected{
  outline:2px solid currentColor;
  outline-offset:-2px;
}

@media(max-width:900px){
  .gd-row.gd-selection-mode{
    grid-template-columns:
      38px
      minmax(0,1fr)
      minmax(0,1fr);
  }

  .gd-row.gd-selection-mode .gd-name{
    grid-column:2/-1;
  }

  .gd-select-cell::before{
    display:none !important;
  }
}

@media(max-width:640px){
  .gd-row.gd-selection-mode{
    grid-template-columns:
      38px
      minmax(0,1fr);
  }

  .gd-row.gd-selection-mode .gd-cell,
  .gd-row.gd-selection-mode .gd-name{
    grid-column:2;
  }
}

/* OMNIA_R6_1F_VISION */
.gd-card-vision-status{
  margin:.35rem 0 .9rem;
  padding:.65rem .8rem;
  border-radius:10px;
  font-size:.9rem;
  line-height:1.35;
  background:color-mix(
    in srgb,
    currentColor 6%,
    transparent
  );
}
.gd-card-vision-status[data-state="working"],
.gd-card-vision-status[data-state="done"],
.gd-card-vision-status[data-state="error"]{
  font-weight:700;
}


/* ============================================================
   R6.1H-R3 — GENERAL DIRECTORY CANONICAL TABLE
   ============================================================ */

.gd-table-shell{
  width:100%;
  min-width:0;
  overflow:hidden;
  border:1px solid var(--ms-border,#d8e2f0);
  border-radius:10px;
  background:var(--ms-surface,#fff);
  box-shadow:0 5px 18px rgba(37,57,92,.06);
}

.gd-table-scroll{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.gd-table{
  width:100%;
  min-width:1500px;
  border-collapse:collapse;
  table-layout:auto;
  font-size:12px;
}

.gd-table th,
.gd-table td{
  padding:9px 10px;
  text-align:left;
  vertical-align:middle;
  white-space:nowrap;
  border-bottom:1px solid var(--ms-border,#d8e2f0);
}

.gd-table thead th{
  position:relative;
  background:var(--ms-surface-soft,#f3f7fc);
  color:var(--ms-text-secondary,#415776);
  font-weight:700;
}

.gd-table tbody tr:hover{
  background:
    var(--ms-surface-hover,rgba(75,104,160,.05));
}

.gd-table tbody tr:last-child td{
  border-bottom:0;
}

.gd-table .gd-name{
  min-width:190px;
}

.gd-table .gd-contact{
  max-width:240px;
  overflow:hidden;
  text-overflow:ellipsis;
}

.gd-select-column{
  width:42px;
  min-width:42px;
  text-align:center !important;
}

.gd-table .gd-actions{
  width:90px;
  min-width:90px;
}

.gd-country-cell{
  display:inline-flex;
  align-items:center;
  gap:7px;
}

.gd-country-flag{
  font-size:17px;
  line-height:1;
}

.gd-column-drag{
  display:inline-block;
  margin-right:7px;
  opacity:.45;
  cursor:grab;
  font-size:11px;
}

.gd-column-resizer{
  position:absolute;
  top:20%;
  right:0;
  width:7px;
  height:60%;
  cursor:col-resize;
  z-index:3;
}

.gd-column-resizer::after{
  content:"";
  position:absolute;
  left:3px;
  top:0;
  width:1px;
  height:100%;
  background:
    var(--ms-border,#c8d4e5);
}

.gd-table-empty{
  padding:24px !important;
  text-align:center !important;
  color:
    var(--ms-text-secondary,#748096);
}

.gd-table-footer{
  min-height:38px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 12px;
  border-top:
    1px solid var(--ms-border,#d8e2f0);
  color:
    var(--ms-text-secondary,#415776);
  font-size:11px;
}

@media(max-width:760px){
  .gd-table{
    min-width:1280px;
  }

  .gd-table-footer{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* ============================================================
   OMNIA_DIRECTORY_CANONICAL_TABLE_ROW_R5
   The canonical General Directory uses a real HTML table.
   Legacy .gd-row grid rules must never change <tr> geometry.
   ============================================================ */

.gd-table tbody tr.gd-row,
.gd-table tbody tr.gd-row.gd-selection-mode {
  display: table-row;
  grid-template-columns: none;
  gap: 0;
  padding: 0;
  min-height: 0;
}

.gd-table tbody tr.gd-row > td,
.gd-table tbody tr.gd-row.gd-selection-mode > td {
  grid-column: auto;
}

.gd-table tbody tr.gd-row .gd-name,
.gd-table tbody tr.gd-row.gd-selection-mode .gd-name,
.gd-table tbody tr.gd-row.gd-selection-mode .gd-cell {
  grid-column: auto;
}
