@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ton-blue: #0098EA;
    --ton-blue-hover: #0088d4;
    --bg-primary: #F7F9FB;
    --bg-white: #FFFFFF;
    --bg-secondary: #EFEFF4;
    --bg-input: #FFFFFF;
    --bg-footer: #F7F9FB;
    --color-success: #1f9d55;
    --color-error: #d64545;
    color-scheme: light;
    --text-primary: #000000;
    --text-secondary: #708499;
    --border-color: #E8E8E8;
    --hover-bg: #F0F4F8;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-pill: 20px;
    --radius-full: 999px;
    --text-on-accent: #fff;
    --font-mono: 'SF Mono', Monaco, 'Courier New', monospace;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.08);
    --logo-shadow: drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000);
    --pill-bg: rgba(255, 255, 255, 0.65);
    --pill-active-bg: #ededed;
}

[data-theme="dark"] {
    color-scheme: dark;
    --ton-blue: #0098EA;
    --ton-blue-hover: #1AA3F0;
    --bg-primary: #161820;
    --bg-white: #1d2636;
    --bg-secondary: #242f42;
    --bg-input: #161820;
    --bg-footer: #1d2636;
    --text-primary: #e7eaf2;
    --text-secondary: #97a1b8;
    --border-color: #273348;
    --hover-bg: #273348;
    --color-success: #68d6a0;
    --color-error: #ff8f9a;
    --shadow-sm: none;
    --shadow-header: 0 1px 0 var(--border-color);
    --pill-bg: #1d2636;
    --pill-active-bg: #344158;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--ton-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-white);
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 40px;
    width: auto;
    filter: var(--logo-shadow);
}

[data-theme="dark"] .logo-img {
    filter: none;
}

.logo:visited {
    color: var(--text-primary);
}

.header-right a {
    padding: 8px 18px;
    background: var(--ton-blue);
    color: var(--text-on-accent);
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 14px;
}

.header-right a:hover {
    background: var(--ton-blue-hover);
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--hover-bg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: fill 0.2s;
}

.theme-toggle:hover svg {
    fill: var(--text-primary);
}

.lang-picker {
    position: relative;
    flex: none;
}

.lang-selector {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 10px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

.lang-selector svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    transition: transform 0.15s ease;
}

.lang-selector[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.lang-selector:hover,
.lang-selector[aria-expanded="true"] {
    background: var(--hover-bg);
}

.lang-selector:focus-visible,
.lang-option:focus-visible {
    outline: 2px solid var(--ton-blue);
    outline-offset: 2px;
}

.lang-menu {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline-start: 0;
    z-index: 10;
    min-width: 168px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

.lang-menu[hidden] {
    display: none;
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    text-align: start;
    cursor: pointer;
}

.lang-option:hover,
.lang-option:focus-visible {
    background: var(--hover-bg);
}

.lang-option[aria-checked="true"] {
    background: var(--bg-secondary);
}

.lang-check {
    color: var(--ton-blue);
    visibility: hidden;
}

.lang-option[aria-checked="true"] .lang-check {
    visibility: visible;
}

[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .header-right {
    flex-direction: row-reverse;
}

[dir="rtl"] .bag-id {
    flex-direction: row-reverse;
}

main {
    flex: 1;
    padding: 20px 12px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.hero {
    text-align: center;
    margin-bottom: 32px;
}

.hero-img {
    height: 120px;
    width: auto;
    filter: var(--logo-shadow);
}

[data-theme="dark"] .hero-img {
    filter: none;
}

.hero-title {
    margin-top: 16px;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}


.search-box {
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.search-box input {
    padding: 12px 20px;
    font-size: 14px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--bg-white);
    color: var(--text-primary);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-sm);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box input:focus {
    outline: 2px solid var(--ton-blue);
}

.search-box button {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--ton-blue);
    color: var(--text-on-accent);
    border: none;
    border-radius: var(--radius-full);
}

.search-box button:hover {
    background: var(--ton-blue-hover);
}

.categories {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    padding: 4px 4px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.categories-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 296px;
    background: var(--pill-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="dark"] .categories-pill {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.categories label {
    flex-shrink: 0;
    height: 35px;
    padding: 0 18px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 510;
    line-height: 18px;
    letter-spacing: -0.08px;
    color: var(--text-primary);
    background: transparent;
    transition: background-color 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}

/* Visually hidden but still focusable/keyboard-navigable (was display:none,
   which removed the radios from the tab order). */
.categories input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.categories label:has(input:focus-visible) {
    outline: 2px solid var(--ton-blue);
    outline-offset: 2px;
}

.categories label:has(input:checked) {
    background: var(--pill-active-bg);
}

.catalog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 12px;
}

.catalog-pagination[hidden] {
    display: none;
}

.catalog-pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

.catalog-pagination button:hover:not(:disabled) {
    background: var(--hover-bg);
}

.catalog-pagination button:focus-visible {
    outline: 2px solid var(--ton-blue);
    outline-offset: 2px;
}

.catalog-pagination button:disabled {
    opacity: 0.5;
    cursor: default;
}

.table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 12px 8px;
}

th {
    background: var(--bg-white);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

#bags-table th {
    text-align: center;
}

#bags-table th:nth-child(-n+2) {
    text-align: left;
}

#bags-table th:last-child {
    text-align: left;
}

td {
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr.clickable-row {
    cursor: pointer;
}

tr.clickable-row:hover td {
    background: var(--hover-bg);
}

.type-svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
}

.bag-name {
    font-weight: 500;
    color: var(--text-primary);
}

.bag-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bag-id:hover {
    color: var(--ton-blue);
}

.app-footer {
    flex: none;
    padding: 22px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-footer);
}

.app-footer-inner {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}

.app-footer-ton {
    display: inline-flex;
    justify-self: start;
    align-items: center;
}

.app-footer-ton img {
    display: block;
    width: 80px;
    height: auto;
    filter: none;
    color-scheme: inherit;
}

.app-footer-links {
    display: flex;
    align-items: center;
    justify-self: center;
    gap: 24px;
}

.app-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

.app-footer-links a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.app-footer-links svg {
    width: 16px;
    height: 16px;
    display: block;
    flex: none;
}

.app-footer-telegram-icon {
    width: 16px;
    height: 16px;
    display: block;
    flex: none;
    background: currentColor;
    -webkit-mask: url('/assets/icons/telegram.svg') center / contain no-repeat;
    mask: url('/assets/icons/telegram.svg') center / contain no-repeat;
}

.app-footer-mtonga {
    display: inline-flex;
    align-items: center;
    justify-self: end;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-flag {
    width: 28px;
    height: 28px;
    display: inline-block;
    flex: none;
    line-height: 0;
}

.footer-flag svg {
    display: block;
    width: 100%;
    height: 100%;
}

main h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.add-page {
    max-width: 576px;
    padding-top: 48px;
    padding-bottom: 48px;
}

.add-intro {
    margin-bottom: 24px;
}

.add-kicker {
    color: var(--ton-blue);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.add-intro h2 {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.04em;
    margin-bottom: 9px;
}

.add-intro > p:last-child {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.wallet-status,
.chain-status,
.add-fee-hint {
    color: var(--text-secondary);
    text-align: center;
    font-size: 11px;
    line-height: 1.6;
    margin-top: 10px;
}

.add-fee-hint {
    margin: 14px 12px 0;
}

.chain-status[data-ready="true"]::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-success);
    margin-inline-end: 6px;
    vertical-align: middle;
}

#upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-white);
    margin: 0 auto;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.form-field-wide,
.add-actions {
    grid-column: 1 / -1;
}

.form-field > label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.field-optional {
    color: var(--text-secondary);
    font-weight: 400;
}

#upload-form input[type="text"] {
    width: 100%;
    height: 46px;
    padding: 10px 16px;
    font: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-primary);
}

#upload-form input::placeholder {
    color: var(--text-secondary);
}

#upload-form input:focus-visible {
    outline: 2px solid var(--ton-blue);
    outline-offset: 2px;
}

#upload-form input#bag-id {
    font-family: var(--font-mono);
    font-size: 12px;
    direction: ltr;
}

.add-actions {
    display: grid;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.visibility-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.visibility-copy small {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    margin-top: 4px;
}

.visibility-option input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: none;
    width: 38px;
    height: 22px;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.visibility-option input::before {
    content: '';
    position: absolute;
    inset-inline-start: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-on-accent);
    transition: inset-inline-start 0.15s ease;
}

.visibility-option input:checked {
    background: var(--ton-blue);
    border-color: var(--ton-blue);
}

.visibility-option input:checked::before {
    inset-inline-start: calc(100% - 18px);
}

#submit-bag {
    min-height: 44px;
    width: 100%;
    padding: 9px 20px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    background: var(--ton-blue);
    color: var(--text-on-accent);
    border: none;
    border-radius: var(--radius-full);
}

#submit-bag:hover {
    background: var(--ton-blue-hover);
}

#submit-bag:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.category-picker {
    position: relative;
}

#upload-form input#bag-category {
    padding-inline-end: 40px;
}

.category-toggle {
    position: absolute;
    inset-inline-end: 4px;
    top: 6px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.category-toggle:hover {
    background: var(--hover-bg);
}

.category-toggle svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.category-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.category-menu {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 6px);
    z-index: 10;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

.category-menu[hidden],
.category-option[hidden] {
    display: none;
}

.category-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    text-align: start;
    cursor: pointer;
}

.category-option:hover,
.category-option.is-active {
    background: var(--hover-bg);
}

.category-option[aria-selected="true"] {
    background: var(--bg-secondary);
}

.category-check {
    color: var(--ton-blue);
    visibility: hidden;
}

.category-option[aria-selected="true"] .category-check {
    visibility: visible;
}

#funding,
#legacy-status {
    margin: 12px auto 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

#funding:empty,
#legacy-status:empty,
.wallet-status:empty {
    display: none;
}

#upload-status {
    width: 100%;
    max-width: 720px;
    margin: 12px auto 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

#upload-status[data-state="success"] {
    color: var(--color-success);
}

#upload-status[data-state="error"] {
    color: var(--color-error);
}

.bag-detail {
    width: 100%;
    max-width: 920px;
    margin: 12px auto 32px;
}

.bag-header {
    max-width: 720px;
    margin: 0 auto 24px;
    text-align: center;
}

.bag-category {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: capitalize;
}

.bag-header h1 {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    word-break: break-word;
}

.bag-panel {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-card {
    border-inline-end: 1px solid var(--border-color);
    padding: 20px 14px;
    text-align: center;
}

.stat-card:last-child {
    border-inline-end: none;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.uploader-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.uploader-value {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.uploader-value a {
    color: var(--ton-blue);
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
}

.bag-id-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.bag-id-section .info-label {
    flex: none;
    margin-bottom: 0;
}

.bag-id-row {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bag-id-row code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    min-width: 0;
    line-height: 1.6;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.bag-id-row code {
    cursor: pointer;
}

.bag-id-row code:hover {
    color: var(--ton-blue);
}

.bag-id.copied,
.bag-id-row code.copied {
    color: var(--color-success);
}

.bag-id:focus-visible,
.bag-id-row code:focus-visible {
    outline: 2px solid var(--ton-blue);
    outline-offset: 3px;
    border-radius: 2px;
}

.files-section {
    padding: 18px 20px;
}

.files-section h2 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.files-list {
    max-height: 400px;
    overflow-y: auto;
}

.file-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    font-size: 13px;
}

.file-row:last-child {
    border-bottom: none;
}

.file-name {
    word-break: break-all;
    flex: 1;
}

.file-size {
    color: var(--text-secondary);
    white-space: nowrap;
}

.loading, .no-files {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

.table-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.skeleton-row {
    pointer-events: none;
}

.skeleton {
    display: block;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.skeleton-name {
    width: min(180px, 85%);
}

.skeleton-value {
    width: 56px;
}

.skeleton-count {
    width: 28px;
}

.skeleton-date {
    width: 72px;
}

.skeleton-id {
    width: min(150px, 90%);
}

@keyframes skeleton-pulse {
    50% {
        opacity: 0.45;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }
}

.faq-container {
    max-width: 700px;
    margin: 0 auto;
}

.faq-title {
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 32px;
}

.faq-item {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.faq-item h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.faq-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.bag-not-found {
    text-align: center;
    padding: 60px 20px;
}

.bag-not-found p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 16px;
}

@media (max-width: 768px) {
    header {
        padding: 12px 16px;
    }

    .logo {
        font-size: 18px;
    }

    .header-right a {
        padding: 8px 12px;
        font-size: 13px;
    }

    main {
        padding: 16px;
    }

    .bag-detail {
        max-width: 560px;
        margin-top: 4px;
    }

    .bag-header {
        margin-bottom: 20px;
    }

    .bag-header h1 {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card:nth-child(2n) {
        border-inline-end: none;
    }

    .stat-card:nth-child(n+3) {
        border-top: 1px solid var(--border-color);
    }

    .uploader-section,
    .bag-id-section,
    .files-section {
        padding: 16px;
    }

    .stat-card {
        padding: 16px 10px;
    }

    .uploader-section {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .uploader-value {
        width: 100%;
    }

    .bag-id-row {
        gap: 8px;
    }

    .bag-id-row code {
        font-size: 10px;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box input {
        max-width: 100%;
    }

    .search-box button {
        width: 100%;
    }

    .categories {
        margin: 0 -16px 16px -16px;
        padding: 0 16px 8px 16px;
    }

    th, td {
        padding: 12px;
        font-size: 13px;
    }

    th:nth-child(4), td:nth-child(4),
    th:nth-child(5), td:nth-child(5),
    th:nth-child(6), td:nth-child(6) {
        display: none;
    }

    .bag-name {
        display: block;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bag-id code {
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100px;
        vertical-align: middle;
    }

    .add-page {
        padding-top: 30px;
    }

    .add-intro h2 {
        font-size: 27px;
    }

    #upload-form {
        grid-template-columns: minmax(0, 1fr);
        padding: 16px;
        gap: 14px;
    }

}

@media (max-width: 760px) {
    .app-footer-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 16px;
    }

    .app-footer-ton,
    .app-footer-links,
    .app-footer-mtonga {
        justify-self: center;
    }

    .app-footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
}
