:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel-soft: #fafbfd;
    --border: #cfd6df;
    --border-strong: #a9b4c2;
    --text: #222;
    --muted: #667085;
    --accent: #d9a77f;
    --accent-dark: #bf8f6a;
    --tab: #e9edf3;
    --tab-active: #f3d5be;
    --header: #f1f4f8;
    --link: #0b63c9;
    --disabled: #eef1f5;
    --table-hover: #f8fbff;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08);
    --bg-side: #f0f2f5;
    --color-danger: #be123c;
    --color-danger-hover: #7c0b26;

    --analyzer-bg: #f3f5f9;
    --analyzer-card: #ffffff;
    --analyzer-title: #183153;
    --analyzer-text: #5f6b7a;
    --analyzer-muted: #8a95a5;
    --analyzer-border: #e7ebf2;
    --analyzer-primary: #3158c9;
    --analyzer-primary-hover: #2748a8;

    --analyzer-blue: #3f73df;
    --analyzer-green: #27a86b;
    --analyzer-red: #ef4b5a;
    --analyzer-orange: #f0a43a;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

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

a {
    color: var(--link);
    text-decoration: underline;
}

a:hover {
    opacity: .85;
}

.app-shell {
    min-height: 100vh;
}

.menu-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-button, .button, .tab-button, button {
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
}

.menu-button.is-active, .button.primary, .tab-button.is-active, button.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-dark);
}

button.primary:hover {
    background-color: var(--accent-dark) !important;
}

.content {
    padding: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.bottom-section {
    position: fixed;
    bottom: 0;
    background-color: var(--bg-side);
    color: darkgrey;
    padding: 10px;
    border-top: 2px solid lightgrey;
    width: 100%;
}

.page-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.page-title-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 22px;
}

.subtitle {
    color: var(--muted);
    font-size: 13px;
}

.header-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fffaf6;
    color: #6a4c36;
    font-size: 13px;
}

.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.breadcrumbs {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    font-size: 20px;
    color: var(--muted);
}

.breadcrumb-button {
    border: unset;
    background-color: transparent;
    color: var(--muted);
    text-decoration: underline;
    padding: unset;
    font-size: 20px;
    text-decoration-thickness: 1px;
}

.breadcrumb-active {
    text-decoration: none;
}

.breadcrumb-button:hover {
    cursor: pointer;
}

.tab-button {
    background: var(--tab);
    border-radius: 6px 6px 0 0;
    min-width: 132px;
}

.tab-button.is-active {
    background: var(--tab-active);
    color: #4b2d18;
}

.group {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    background: var(--panel-soft);
}

.group-title {
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 12px;
    color: #344054;
}

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

.two-col {
    grid-template-columns: 1fr 1fr;
}

.field-grid {
    display: grid;
    grid-template-columns: 108px 1fr;
    gap: 10px 12px;
    align-items: center;
}

.field-grid.compact {
    grid-template-columns: 88px 1fr;
}

label {
    font-size: 13px;
    color: #344054;
}

input[type="text"], input[type="date"], input[type="datetime-local"], select, textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    padding: 7px 9px;
    background: #fff;
    font-size: 14px;
}

input[disabled], textarea[disabled], select[disabled] {
    background: var(--disabled);
    color: #4b5563;
}

textarea {
    resize: vertical;
    min-height: 110px;
}

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

.table-wrap {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.table-scroll {
    max-height: 520px;
    overflow: auto;
}

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

thead th {
    position: sticky;
    top: 0;
    background: var(--header);
    z-index: 1;
    font-weight: bold;
    font-size: 13px;
    border-bottom: 1px solid var(--border-strong);
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
    white-space: nowrap;
}

tbody tr:hover {
    background: var(--table-hover);
}

h4 {
    margin: 0;
}

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 6px 0;
    flex-wrap: wrap;
}

.pager .numbers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pager button {
    min-width: 36px;
    padding: 6px 10px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.helper-text {
    font-size: 12px;
    color: var(--muted);
}

.kv-item {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.spacer {
    flex: 1 1 auto;
}

.message {
    padding: 8px 10px;
    border-radius: 4px;
    background: #edf7ed;
    border: 1px solid #c6e2ce;
    color: #1b5e20;
    font-size: 13px;
}

.error {
    background: #fff5f5;
    border-color: #f0c2c2;
    color: #8a1c1c;
}

.footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.history-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
}

.history-card + .history-card {
    margin-top: 10px;
}

.history-card .row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px;
    margin-bottom: 6px;
}

.history-card .row:last-child {
    margin-bottom: 0;
}

.doc-input-table select, .doc-input-table input {
    min-width: 100%;
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .two-col, .m201-main {
        grid-template-columns: 1fr !important;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-header {
    padding: 2px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2px 16px;
}

.modal-footer {
    padding: 2px 16px;
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    padding: 15px;
    border: 1px solid #888;
    width: 50%;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    animation-name: animate-modal;
    animation-duration: 0.2s;

    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    justify-content: center;
    align-items: center;
}

@keyframes animate-modal {
    from {
        top: -50px;
        opacity: 0
    }
    to {
        top: 0;
        opacity: 1
    }
}

span[id$="-modal-close"] {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

span[id$="-modal-close"]:hover,
span[id$="-modal-close"]:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#notifications {
    position: fixed;
    right: 0;
    top: 0;
    overflow: auto;
    width: 350px;
}

.notification {
    width: 300px;
    border-radius: 5px;
    background-color: white;
    border: 1px solid var(--border);
    margin-left: auto;
    margin-right: 5%;
    margin-top: 5%;

    animation-name: animate-notification;
    animation-duration: 0.4s;
}

.notification .notification-header {
    padding: 5px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.notification.success {
    color: #236a53;
    background-color: #d4e8e1;
}

.notification.danger {
    color: #be123c;
    background-color: #fcdde3;
}

.notification .notification-content {
    padding: 5px;
}

@keyframes animate-notification {
    from {
        margin-right: 0;
        opacity: 0;
    }
    to {
        margin-right: 5%;
        opacity: 1;
    }
}

.header-logo {
    color: black;
    text-decoration: unset;
}

.app-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--analyzer-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 48px;
}

.app-header-title {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
}

.app-nav {
    display: flex;
    gap: 32px;
    height: 100%;
    align-items: center;
}

.app-nav a {
    height: 100%;
    display: flex;
    align-items: center;
    color: #7b8494;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 3px solid transparent;
    transition: .15s;
}

.app-nav a:hover {
    color: var(--analyzer-blue);
}

.app-nav a.active {
    color: var(--analyzer-blue);
    border-bottom-color: var(--analyzer-blue);
}
