/* Tabular document viewer */
.doc-layer.table-mode {
    padding: 1.35rem;
    background:
        radial-gradient(circle at 12% 0%, rgba(42, 139, 255, 0.14), transparent 34%),
        linear-gradient(180deg, #f4f8ff 0%, #edf3fc 100%);
}

.doc-layer.table-mode .doc-canvas {
    border: 1px solid rgba(176, 201, 232, 0.78);
    border-radius: 24px;
    background: rgba(247, 251, 255, 0.94);
    box-shadow: 0 28px 70px rgba(18, 46, 92, 0.18);
}

.doc-layer.table-mode .title-bar,
.doc-layer.table-mode .doc-toolbar {
    display: none;
}

.doc-layer.table-mode #docHost,
.doc-layer.table-mode #docHostGeneric {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: transparent;
}

.table-viewer-shell {
    height: 100%;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    gap: 1rem;
    padding: clamp(1rem, 2vw, 1.45rem);
    color: #102754;
}

.table-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    color: #5f789f;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-breadcrumb .arc-flow-crumb-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.table-breadcrumb .is-current {
    color: #1f62f0;
}

.table-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(176, 201, 232, 0.74);
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 10%, rgba(31, 98, 240, 0.14), transparent 30%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(235, 244, 255, 0.92));
}

.table-back-btn {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(127, 159, 205, 0.72);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: #153768;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-hero-copy {
    min-width: 0;
}

.table-kicker {
    display: inline-flex;
    margin-bottom: 0.28rem;
    color: #1f62f0;
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-hero-copy h2 {
    margin: 0;
    color: #0f2447;
    font-size: clamp(1.2rem, 1.6vw, 1.7rem);
    font-weight: 850;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.table-hero-copy p {
    margin: 0.35rem 0 0;
    color: #60739a;
    font-size: 0.9rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.table-meta {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    margin: 0;
}

.table-meta div {
    min-width: 92px;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(176, 201, 232, 0.74);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
}

.table-meta dt {
    color: #6a7fa2;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-meta dd {
    margin: 0.18rem 0 0;
    color: #132a54;
    font-size: 0.82rem;
    font-weight: 800;
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.table-search {
    flex: 1 1 320px;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.9rem;
    border: 1px solid rgba(127, 159, 205, 0.72);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: #55709c;
}

.table-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #102754;
    font-weight: 650;
}

.table-count,
.table-action {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0 0.95rem;
    border-radius: 12px;
    font-weight: 850;
}

.table-count {
    color: #1f62f0;
    background: rgba(31, 98, 240, 0.1);
}

.table-viewer-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.table-action {
    border: 1px solid rgba(31, 98, 240, 0.48);
    background: #1f62f0;
    color: #fff;
    text-decoration: none;
}

.table-surface {
    min-height: 0;
    overflow: auto;
    border: 1px solid rgba(176, 201, 232, 0.8);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
}

.table-preview {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: #132a54;
}

.table-preview th,
.table-preview td {
    max-width: 420px;
    padding: 0.72rem 0.85rem;
    border-right: 1px solid rgba(176, 201, 232, 0.58);
    border-bottom: 1px solid rgba(176, 201, 232, 0.58);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.table-preview th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #dceaff;
    color: #143b75;
    font-size: 0.78rem;
    font-weight: 850;
    text-align: left;
}

.table-preview tbody tr:nth-child(even) td {
    background: rgba(239, 246, 255, 0.74);
}

.table-preview tbody tr:hover td {
    background: rgba(218, 234, 255, 0.9);
}

.table-empty {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 2rem;
    color: #60739a;
    text-align: center;
}

.table-empty i {
    color: #1f62f0;
    font-size: 2.25rem;
}

.table-empty strong {
    color: #102754;
    font-size: 1.05rem;
}

.table-footer {
    color: #60739a;
    font-size: 0.84rem;
    font-weight: 700;
}

html[data-theme="dark"] .doc-layer.table-mode,
body[data-theme="dark"] .doc-layer.table-mode {
    background:
        radial-gradient(circle at 12% 0%, rgba(68, 215, 255, 0.1), transparent 34%),
        linear-gradient(180deg, #061a33 0%, #071528 100%) !important;
}

html[data-theme="dark"] .doc-layer.table-mode .doc-canvas,
body[data-theme="dark"] .doc-layer.table-mode .doc-canvas {
    border-color: rgba(76, 114, 177, 0.58) !important;
    background: rgba(9, 29, 55, 0.96) !important;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42) !important;
}

html[data-theme="dark"] .table-viewer-shell,
body[data-theme="dark"] .table-viewer-shell {
    color: #edf5ff;
}

html[data-theme="dark"] .table-breadcrumb,
body[data-theme="dark"] .table-breadcrumb {
    color: #a9c1e8;
}

html[data-theme="dark"] .table-breadcrumb .is-current,
body[data-theme="dark"] .table-breadcrumb .is-current,
html[data-theme="dark"] .table-kicker,
body[data-theme="dark"] .table-kicker {
    color: #8dbbff;
}

html[data-theme="dark"] .table-hero,
body[data-theme="dark"] .table-hero {
    border-color: rgba(76, 114, 177, 0.58);
    background:
        radial-gradient(circle at 92% 10%, rgba(68, 215, 255, 0.12), transparent 30%),
        linear-gradient(145deg, rgba(18, 50, 91, 0.96), rgba(12, 35, 68, 0.96));
}

html[data-theme="dark"] .table-back-btn,
body[data-theme="dark"] .table-back-btn,
html[data-theme="dark"] .table-meta div,
body[data-theme="dark"] .table-meta div,
html[data-theme="dark"] .table-search,
body[data-theme="dark"] .table-search,
html[data-theme="dark"] .table-surface,
body[data-theme="dark"] .table-surface {
    border-color: rgba(87, 137, 205, 0.52);
    background: rgba(9, 30, 58, 0.82);
    color: #dceaff;
}

html[data-theme="dark"] .table-hero-copy h2,
body[data-theme="dark"] .table-hero-copy h2,
html[data-theme="dark"] .table-meta dd,
body[data-theme="dark"] .table-meta dd,
html[data-theme="dark"] .table-empty strong,
body[data-theme="dark"] .table-empty strong,
html[data-theme="dark"] .table-search input,
body[data-theme="dark"] .table-search input {
    color: #f2f7ff;
}

html[data-theme="dark"] .table-hero-copy p,
body[data-theme="dark"] .table-hero-copy p,
html[data-theme="dark"] .table-meta dt,
body[data-theme="dark"] .table-meta dt,
html[data-theme="dark"] .table-empty,
body[data-theme="dark"] .table-empty,
html[data-theme="dark"] .table-footer,
body[data-theme="dark"] .table-footer {
    color: #a8bfdf;
}

html[data-theme="dark"] .table-preview,
body[data-theme="dark"] .table-preview {
    color: #dbeaff;
}

html[data-theme="dark"] .table-preview th,
body[data-theme="dark"] .table-preview th {
    border-color: rgba(87, 137, 205, 0.48);
    background: #123b6c;
    color: #eff6ff;
}

html[data-theme="dark"] .table-preview td,
body[data-theme="dark"] .table-preview td {
    border-color: rgba(87, 137, 205, 0.28);
}

html[data-theme="dark"] .table-preview tbody tr:nth-child(even) td,
body[data-theme="dark"] .table-preview tbody tr:nth-child(even) td {
    background: rgba(15, 43, 80, 0.72);
}

html[data-theme="dark"] .table-preview tbody tr:hover td,
body[data-theme="dark"] .table-preview tbody tr:hover td {
    background: rgba(31, 88, 153, 0.66);
}

@media (max-width: 860px) {
    .doc-layer.table-mode {
        padding: 0.65rem;
    }

    .table-hero {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .table-meta {
        grid-column: 1 / -1;
        flex-wrap: wrap;
    }
}
