/**
 * styles/layout.css
 * Shared application shell and layout styles.
 */

:root {
    --s4-bg-top: #edf4ee;
    --s4-bg-bottom: #dfe8e2;
    --s4-surface: #ffffff;
    --s4-surface-alt: #f6faf7;
    --s4-border: #d8e2db;
    --s4-border-strong: #b7c8bc;
    --s4-shadow: 0 18px 44px rgba(31, 52, 39, 0.12);
    --s4-shadow-soft: 0 10px 24px rgba(31, 52, 39, 0.08);
    --s4-radius: 18px;
    --s4-radius-small: 10px;
    --s4-text: #21352b;
    --s4-muted: #5f7266;
    --s4-brand: #285943;
    --s4-brand-strong: #173d2b;
    --s4-brand-soft: #e7f1ea;
    --s4-accent: #c99a3a;
    --s4-danger: #b54444;
    --s4-success: #2f7a4f;
    --s4-info: #3265a7;
    --s4-page-width: 1180px;
    --s4-sidebar-width: 260px;
    --s4-space-1: 8px;
    --s4-space-2: 12px;
    --s4-space-3: 16px;
    --s4-space-4: 24px;
    --s4-space-5: 32px;
    --s4-space-6: 40px;
}

body {
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.8), transparent 42%),
        linear-gradient(180deg, var(--s4-bg-top) 0%, var(--s4-bg-bottom) 100%);
    margin: 0;
    min-height: 100vh;
    color: var(--s4-text);
}

div.fullWidth,
div.dialogWidth {
    width: min(calc(100% - 32px), var(--s4-page-width));
    margin: 24px auto;
}

div.dialogWidth {
    max-width: 760px;
}

#top {
    position: relative;
}

.s4-shell {
    display: block;
}

.s4-frame {
    background: var(--s4-surface);
    border: 1px solid rgba(216, 226, 219, 0.9);
    border-radius: var(--s4-radius);
    box-shadow: var(--s4-shadow);
    overflow: hidden;
}

#header {
    background:
        linear-gradient(135deg, rgba(40, 89, 67, 0.96), rgba(23, 61, 43, 0.96)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
    color: #ffffff;
    padding: var(--s4-space-4);
}

.s4-brandbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s4-space-4);
    margin-bottom: var(--s4-space-4);
}

.s4-brandmark {
    display: flex;
    align-items: center;
    min-height: 58px;
}

.s4-brandmark img {
    max-width: 100%;
    height: auto;
}

#fontSelector {
    border-collapse: collapse;
    margin-left: auto;
}

#fontSelector td {
    padding: 0 0 2px 4px;
    vertical-align: top;
}

#fontSelector .fsLink {
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

#fontSelector .fsLink:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

#userInfoArea {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    margin-left: auto;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.94);
    text-align: right;
}

#uiaBodyshop {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95em;
}

#uiaUser {
    font-weight: bold;
}

a#uiaLogout {
    color: #ffffff;
    text-decoration: none;
    margin-left: 10px;
}

a#uiaLogout:hover {
    color: #dfeee5;
    text-decoration: underline;
}

.s4-master-banner {
    width: min(calc(100% - 32px), 900px);
    margin: 18px auto 0;
    padding: 14px 18px;
    border: 1px solid #d8dfc0;
    border-radius: 14px;
    background: #fff7d8;
    color: #56471d;
    text-align: center;
    box-shadow: var(--s4-shadow-soft);
}

.menu-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.menu-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.86);
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.02em;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-tab:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    transform: translateY(-1px);
}

.menu-tab.active {
    background: #ffffff;
    color: var(--s4-brand-strong);
    box-shadow: 0 8px 20px rgba(7, 20, 12, 0.16);
}

#menubar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: var(--s4-space-3);
    padding-top: var(--s4-space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

#menubar a {
    color: rgba(255, 255, 255, 0.86);
    text-decoration: none;
    font-size: 0.95em;
}

#menubar a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.emptyMenu {
    min-height: 8px;
}

#pageLayout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--s4-sidebar-width);
    gap: 0;
    align-items: start;
}

#pageBody {
    padding: var(--s4-space-5);
    min-width: 0;
}

#sidebarTL,
#sidebarT,
#sidebarL {
    display: none;
}

#sidebarContent {
    padding: var(--s4-space-5) var(--s4-space-5) var(--s4-space-5) 0;
}

#sidebarContent > * {
    background: var(--s4-surface-alt);
    border: 1px solid var(--s4-border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--s4-shadow-soft);
}

#footerText,
#cookie {
    text-align: center;
    color: var(--s4-muted);
}

#cookie {
    margin: 18px auto 0;
    padding: 0 var(--s4-space-3);
}

#cookie a,
#cookie a:visited,
#cookie a:active,
#footerText a,
#footerText a:visited {
    color: var(--s4-muted);
}

#footerText {
    margin: 14px auto 24px;
    padding: 0 var(--s4-space-3);
    font-size: 0.92em;
}

#cookie a:hover,
#footerText a:hover {
    color: var(--s4-brand);
    text-decoration: none;
}

#HTML_AJAX_LOADING {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(40, 89, 67, 0.96);
    color: #ffffff;
    box-shadow: var(--s4-shadow-soft);
    font-size: 0.95em;
    font-weight: bold;
}

table tr.unchecked td {
    background: var(--s4-danger) !important;
    color: #ffffff !important;
}

table tr.checked td {
    background: var(--s4-success) !important;
    color: #ffffff !important;
}

.page-intro-card,
.section-card,
.action-card,
.auth-card,
.quota-card,
.sheet-summary,
.completion-card,
.audit-actions,
.files-toolbar {
    background: var(--s4-surface-alt);
    border: 1px solid var(--s4-border);
    border-radius: 16px;
    box-shadow: var(--s4-shadow-soft);
}

.page-intro-card,
.auth-card,
.sheet-summary,
.completion-card {
    padding: 24px;
}

.page-actions,
.files-toolbar,
.audit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.audit-actions {
    justify-content: flex-end;
}

.quota-card {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--s4-muted);
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.folder-card {
    display: block;
    padding: 22px 18px;
    text-align: center;
    text-decoration: none;
    border: 1px solid var(--s4-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
    box-shadow: var(--s4-shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.folder-card:hover {
    transform: translateY(-3px);
    border-color: #b9cbbc;
    box-shadow: 0 16px 32px rgba(31, 52, 39, 0.11);
    text-decoration: none;
}

.folder-card img {
    display: inline-block;
    margin-bottom: 12px;
}

.folder-name {
    font-size: 15px;
    font-weight: bold;
    color: var(--s4-brand-strong);
}

.folder-file-count {
    color: var(--s4-muted);
    font-weight: normal;
}

.auth-shell {
    max-width: 620px;
    margin: 0 auto;
}

.auth-copy {
    text-align: center;
    margin-bottom: 18px;
}

.auth-note {
    margin-top: 20px;
    text-align: center;
    color: var(--s4-muted);
}

.form-stack {
    display: grid;
    gap: 16px;
}

.form-row-inline {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.form-actions-right {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.audit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}

.audit-sidecard {
    position: sticky;
    top: 16px;
    padding: 18px;
}

.signature-block {
    padding: 16px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--s4-border);
}

.recordkeeping-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.recordkeeping-group {
    margin-bottom: 28px;
}

.recordkeeping-footer {
    margin: 18px 0 0;
    color: var(--s4-muted);
}

.comment-dialog {
    display: none;
    border-radius: 14px;
    background: #ffffff;
    padding: 18px;
    box-shadow: var(--s4-shadow-soft);
}

.comment-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--s4-border);
    background: #ffffff;
    color: var(--s4-brand);
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
}

.comment-trigger:hover {
    background: var(--s4-brand-soft);
    text-decoration: none;
}

@media (max-width: 980px) {
    div.fullWidth,
    div.dialogWidth {
        width: min(calc(100% - 20px), var(--s4-page-width));
        margin: 14px auto;
    }

    .s4-brandbar {
        flex-direction: column;
    }

    #userInfoArea {
        width: auto;
        margin-left: 0;
        text-align: left;
    }

    #pageLayout,
    .audit-layout {
        grid-template-columns: 1fr;
    }

    #pageBody,
    #sidebarContent {
        padding: 20px;
    }

    #sidebarContent {
        padding-top: 0;
    }

    .audit-sidecard {
        position: static;
    }
}

@media (max-width: 720px) {
    #header {
        padding: 18px;
    }

    #pageBody {
        padding: 18px;
    }

    .menu-tabs {
        gap: 8px;
    }

    .menu-tab {
        width: 100%;
        justify-content: flex-start;
    }

    #menubar {
        gap: 8px 14px;
    }

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

    .page-actions,
    .files-toolbar,
    .audit-actions,
    .recordkeeping-meta {
        align-items: stretch;
    }
}
