/* サインまモル - CloudSign-inspired Design */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #253981;
    --primary-dark: #1a2b5e;
    --primary-hover: #1e3070;
    --primary-light: #EBF0FF;
    --accent: #f05068;
    --accent-hover: #e03858;
    --danger: #D93025;
    --danger-hover: #B3261E;
    --success: #0D904F;
    --success-light: #E6F4EA;
    --warning: #E37400;
    --warning-light: #FEF7E0;
    --text: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border: #E0E0E0;
    --bg: #F5F6F8;
    --card-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --header-h: 60px;
    --sidebar-w: 220px;
    --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, sans-serif;
}

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-logo {
    display: flex;
    align-items: center;
    min-width: 280px;
    cursor: pointer;
    text-decoration: none;
}
.header-logo-img {
    height: 36px;
    width: auto;
    min-width: 250px;
    object-fit: contain;
    object-position: left center;
    filter: brightness(0) invert(1);
}

.header-search-bar {
    flex: 1;
    max-width: 520px;
    margin: 0 24px;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.header-search-bar input {
    flex: 1;
    border: 1px solid #ccc;
    border-right: none;
    outline: none;
    padding: 9px 14px;
    font-size: 13px;
    background: white;
    color: #333;
    border-radius: 4px 0 0 4px;
}
.header-search-bar input::placeholder { color: #999; }
.header-search-bar .search-btn {
    background: #4A5A7A;
    border: none;
    color: white;
    padding: 9px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 4px 4px 0;
    transition: background 0.2s;
}
.header-search-bar .search-btn:hover { background: #3d4d6a; }

/* Legacy header-search hide */
.header-search { display: none !important; }
.header-nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: 32px;
}
.header-link {
    color: rgba(255,255,255,0.85) !important;
    font-size: 13px;
    text-decoration: none !important;
    cursor: pointer;
}
.header-link:hover { color: white !important; }
.header-search-expand {
    margin-left: 16px;
    flex: 0 1 300px;
}
.header-search-expand input {
    width: 100%;
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 13px;
    outline: none;
    font-family: var(--font);
}
.header-search-expand input::placeholder { color: rgba(255,255,255,0.5); }
.header-search-expand input:focus { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.25); }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.header-right .help-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.header-right .help-btn:hover { background: rgba(255,255,255,0.25); }
.header-right .user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    position: relative;
    border: 1px solid rgba(255,255,255,0.3);
    transition: all 0.2s;
}
.header-right .user-menu:hover { background: rgba(255,255,255,0.15); }
.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.user-name { font-size: 15px; color: white; font-weight: 500; }
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    margin-top: 8px;
}
.user-dropdown.show { display: block; }
.user-dropdown a, .user-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--bg); text-decoration: none; }
.user-dropdown .divider { height: 1px; background: var(--border); margin: 4px 0; }

/* === Layout === */
.layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    flex-shrink: 0;
    overflow-y: auto;
}
.sidebar-new-btn {
    display: block;
    margin: 4px 16px 20px;
    padding: 12px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    text-decoration: none;
    letter-spacing: 0.3px;
}
.sidebar-new-btn:hover { background: var(--accent-hover); text-decoration: none; color: white; }

.sidebar-section { margin-bottom: 8px; }
.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 20px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 9px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
    position: relative;
}
.sidebar-item .icon { display: none; }
.sidebar-item:hover {
    background: #F7F8FA;
    color: var(--text);
    text-decoration: none;
}
.sidebar-item.active {
    border-left-color: var(--accent);
    background: #FFF5F6;
    color: var(--accent);
    font-weight: 600;
}
.sidebar-item .badge {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 13px;
    background: none;
    padding: 0;
    font-weight: 400;
}
.sidebar-item.active .badge {
    background: none;
    color: var(--accent);
}
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}

/* === Main Content === */
.main-content {
    flex: 1;
    padding: 16px 16px;
    overflow-y: auto;
    min-width: 0;
}

/* === Cards === */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

/* === Status Cards (hidden by default, CloudSign style) === */
.status-cards { display: none; }

/* === Table === */
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
tbody tr { cursor: pointer; transition: background 0.15s; }
tbody tr:hover { background: #F7F8FA; }
tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #F0F0F0;
    font-size: 13px;
}
.doc-title-cell { font-weight: 500; color: var(--text); }
.doc-title-cell small {
    display: block;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

/* === Status Badge === */
.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.status-draft { background: #F1F3F4; color: var(--text-secondary); }
.status-pending_approval,
.status-pending_signing { background: var(--primary-light); color: var(--primary); }
.status-completed { background: var(--success-light); color: var(--success); }
.status-declined,
.status-cancelled { background: #FCE8E6; color: var(--danger); }
.status-rejected { background: var(--warning-light); color: var(--warning); }
.status-imported { background: #EBF5FF; color: #1967D2; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #0B7B43; }
.btn-outline {
    background: white;
    color: var(--primary);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: var(--primary); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 10px 28px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: white;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,57,129,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input::placeholder { color: var(--text-light); }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* === Steps Indicator === */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0 28px;
}
.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
}
.step .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-light);
    flex-shrink: 0;
}
.step.active .step-num { background: var(--primary); border-color: var(--primary); color: white; }
.step.done .step-num { background: var(--success); border-color: var(--success); color: white; }
.step.active .step-label { color: var(--primary); font-weight: 500; }
.step.done .step-label { color: var(--success); }
.step-connector { width: 60px; height: 2px; background: var(--border); margin: 0 8px; }
.step.done + .step-connector, .step-connector.done { background: var(--success); }

/* === Upload Area === */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #FAFBFC;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-area .upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-area p { color: var(--text-secondary); font-size: 14px; }
.upload-area .upload-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* === Recipient Card === */
.recipient-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.recipient-info { flex: 1; }
.recipient-name { font-weight: 500; font-size: 14px; }
.recipient-email { font-size: 13px; color: var(--text-secondary); display: block; margin-top: 2px; }
.recipient-company { font-size: 12px; color: var(--text-light); }

/* === Document Detail === */
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-info-section { margin-bottom: 20px; }
.detail-info-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.detail-row { display: flex; padding: 6px 0; font-size: 13px; }
.detail-label { width: 120px; color: var(--text-secondary); flex-shrink: 0; }
.detail-value { color: var(--text); flex: 1; }

/* === PDF Viewer === */
.pdf-viewer { background: #525659; border-radius: var(--radius); overflow: hidden; position: relative; }
.pdf-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 13px;
}
.pdf-page-nav button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.pdf-page-nav button:hover { background: rgba(255,255,255,0.25); }
.pdf-canvas-wrap {
    display: flex;
    justify-content: center;
    padding: 16px;
    overflow: auto;
    max-height: 70vh;
}
.pdf-canvas-wrap canvas { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* === Field Placement === */
.field-editor { display: flex; height: calc(100vh - var(--header-h) - 80px); }
.field-toolbar {
    width: 200px;
    background: white;
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
}
.field-toolbar h4 { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; }
.field-tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: grab;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text);
    transition: all 0.15s;
}
.field-tool-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.field-tool-btn .tool-icon { font-size: 16px; }
.field-assign-section { margin-top: 16px; }
.field-pdf-area { flex: 1; background: #525659; overflow: auto; display: flex; justify-content: center; padding: 16px; }
.pdf-page-wrapper { position: relative; display: inline-block; }
.field-overlay {
    position: absolute;
    border: 2px solid var(--primary);
    background: rgba(37,57,129,0.08);
    border-radius: 3px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--primary);
    user-select: none;
}
.field-overlay.stamp { border-color: #CC1111; background: rgba(204,17,17,0.08); border-radius: 50%; color: #CC1111; }
.field-overlay .field-label {
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 10px;
    background: var(--primary);
    color: white;
    padding: 1px 6px;
    border-radius: 2px;
    white-space: nowrap;
}
.field-overlay.stamp .field-label { background: #CC1111; }
.field-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.field-overlay:hover .field-delete { display: flex; }
.field-resize { position: absolute; bottom: -4px; right: -4px; width: 10px; height: 10px; background: var(--primary); cursor: se-resize; border-radius: 2px; }

/* === Contact Card === */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.contact-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: box-shadow 0.2s;
}
.contact-card:hover { box-shadow: var(--shadow); }
.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info .name { font-weight: 500; font-size: 14px; }
.contact-info .email { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
.contact-info .company { font-size: 12px; color: var(--text-light); }
.contact-actions { display: flex; gap: 4px; }

/* === Template Card === */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.template-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: box-shadow 0.2s;
}
.template-card:hover { box-shadow: var(--shadow-lg); }
.template-card h4 { font-size: 15px; margin-bottom: 8px; }
.template-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.template-card .actions { display: flex; gap: 8px; }

/* === Settings Tabs === */
.settings-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.settings-tab {
    padding: 10px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: var(--font);
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* === Signing Page === */
.signing-container { max-width: 900px; margin: 0 auto; padding: 24px; }
.signing-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.signing-header .logo {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
}
.signing-header .logo img { height: 32px; filter: brightness(0) invert(1); }
.signing-message {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    font-size: 14px;
}
.signing-actions { display: flex; gap: 12px; justify-content: center; padding: 24px; }

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #3a5090 100%);
}
.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 48px 40px;
    width: 100%;
    max-width: 620px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { font-size: 40px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 24px; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.login-logo-img { max-width: 100%; width: 560px; height: auto; margin-bottom: 8px; }
.login-error {
    background: #FCE8E6;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* === Empty State === */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* === Toast === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === Audit Log === */
.audit-log { list-style: none; }
.audit-log li { padding: 8px 0; border-bottom: 1px solid #F0F0F0; font-size: 13px; display: flex; gap: 12px; }
.audit-log .time { color: var(--text-light); min-width: 120px; }
.audit-log .action-text { color: var(--text); }

/* === Modal === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* === Utilities === */
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.font-medium { font-weight: 500; }

/* === Toolbar === */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: white; border-bottom: 1px solid var(--border); }
.toolbar-group { display: flex; gap: 6px; }
.toolbar-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.toolbar-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px;
    background: #F1F3F4;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.page-nav button { background: white; border: 1px solid var(--border); padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.page-nav button:hover { background: var(--bg); }

/* === Notification bell === */
.notification-bell { position: relative; cursor: pointer; padding: 6px; border-radius: 50%; color: white; font-size: 16px; }
.notification-bell:hover { background: rgba(255,255,255,0.15); }
.notification-bell .bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

/* === Signing fields === */
.signing-field {
    position: absolute;
    border: 2px solid var(--primary);
    background: rgba(37,57,129,0.1);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}
.signing-field:hover { background: rgba(37,57,129,0.2); }
.signing-field.stamp { border-color: #CC1111; background: rgba(204,17,17,0.1); border-radius: 50%; }
.signing-field.filled { border-color: var(--success); background: rgba(13,144,79,0.1); }
.signing-field input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 13px;
    padding: 2px 4px;
    font-family: var(--font);
}
.signing-field input:focus { outline: none; }

/* === Access Code === */
.access-code-form { max-width: 400px; margin: 60px auto; text-align: center; }
.access-code-form .icon { font-size: 48px; margin-bottom: 16px; }
.access-code-form h2 { margin-bottom: 8px; }
.access-code-form p { color: var(--text-secondary); margin-bottom: 24px; }
.access-code-input { font-size: 24px; text-align: center; letter-spacing: 8px; padding: 12px; width: 100%; margin-bottom: 16px; }

/* === Footer === */
.footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    background: white;
}
.footer a { color: var(--text-secondary); margin: 0 8px; }

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .header-search-bar { display: none; }
    .header-nav-links { display: none; }
    .status-cards { grid-template-columns: repeat(2, 1fr); }
    .detail-layout { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .main-content { padding: 16px; }
}


/* === CloudSign Login - Pixel Perfect === */
.cs-login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, sans-serif;
}
.cs-login-header {
    padding: 12px 20px;
    background: transparent;
}
.cs-login-header-logo {
    height: 28px;
    width: auto;
}
.cs-login-header-border {
    height: 1px;
    background: #E0E0E0;
}
.cs-login-body {
    flex: 1;
    display: flex;
    min-height: 0;
}
.cs-login-left {
    flex: 0 0 50%;
    max-width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F5F5;
    border-right: 1px solid #E0E0E0;
    padding: 40px 20px;
}
.cs-login-card {
    width: 100%;
    max-width: 380px;
    background: transparent;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    padding: 40px 36px;
}
.cs-login-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: 0.5px;
}
.cs-form-group {
    margin-bottom: 20px;
}
.cs-form-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 400;
}
.cs-form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CCC;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: transparent;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.cs-form-input:focus {
    border-color: #4285F4;
    box-shadow: 0 0 0 1px #4285F4;
}
.cs-form-input::placeholder {
    color: #BBB;
    font-size: 13px;
}
.cs-login-btn {
    display: block;
    width: 100%;
    padding: 13px;
    background: #E8546A;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    transition: background 0.2s;
    letter-spacing: 1px;
    font-family: inherit;
}
.cs-login-btn:hover {
    background: #D4475C;
}
.cs-login-right {
    flex: 0 0 50%;
    max-width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: transparent;
}
.cs-login-ad {
    max-width: 480px;
    width: 100%;
}
.cs-login-footer {
    padding: 14px 24px;
    border-top: 1px solid #E0E0E0;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.cs-login-footer a,
.cs-login-footer span {
    font-size: 11px;
    color: #999;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.cs-login-footer a:hover {
    color: #666;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .cs-login-body { flex-direction: column; }
    .cs-login-left, .cs-login-right { flex: none; max-width: 100%; }
    .cs-login-right { display: none; }
}

/* Sidebar footer copyright */

/* === CloudSign-matching styles === */

/* Header search select (teal dropdown) */


/* Help icon circle */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

/* User avatar - dashed border style */
.user-avatar {
    width: 36px !important;
    height: 36px !important;
    border: 2px dashed rgba(255,255,255,0.6) !important;
    background: rgba(255,255,255,0.15) !important;
    font-size: 14px !important;
}

/* Sidebar status divider (between 下書き and 締結済み) */
.sidebar-status-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 16px;
}

/* Dashboard banner */
.dashboard-banner {
    background: linear-gradient(135deg, #253981 0%, #3a5ca8 100%);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    color: white;
}
.dashboard-banner h2 { font-size: 20px; margin-bottom: 8px; font-weight: 600; }
.dashboard-banner p { font-size: 14px; opacity: 0.85; }

/* Dashboard stats section */
.dashboard-stats-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.dashboard-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
}
.dashboard-stats-content {
    display: flex;
    align-items: center;
    gap: 48px;
}
.donut-chart-container {
    position: relative;
    width: 180px;
    height: 180px;
    flex-shrink: 0;
}
.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.donut-center small { font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.donut-legend { display: flex; flex-direction: column; gap: 12px; }
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}
.legend-item strong { margin-left: auto; min-width: 30px; text-align: right; color: var(--text); }
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Dashboard info cards */
.dashboard-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.dashboard-info-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.dashboard-info-card:hover { box-shadow: var(--shadow-lg); }
.info-card-icon { font-size: 32px; margin-bottom: 12px; }
.dashboard-info-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.dashboard-info-card p { font-size: 13px; color: var(--text-secondary); }

/* === CloudSign Document List Styles === */

/* Sidebar active color variants */
.sidebar-item.active.active-blue {
    border-left-color: #4285F4;
    background: #EBF0FF;
    color: #4285F4;
}
.sidebar-item.active.active-blue .badge { color: #4285F4; }

.sidebar-item.active.active-orange {
    border-left-color: #E37400;
    background: #FEF7E0;
    color: #E37400;
}
.sidebar-item.active.active-orange .badge { color: #E37400; }

.sidebar-item.active.active-red {
    border-left-color: #D93025;
    background: #FDECEA;
    color: #D93025;
}
.sidebar-item.active.active-red .badge { color: #D93025; }

/* Document list container */
.doc-list-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    min-height: 400px;
}

.doc-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 12px;
}

.doc-list-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

/* Pagination */
.doc-list-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}
.pagination-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
}
.pagination-btn:hover:not(:disabled) { background: #F5F6F8; }
.pagination-btn:disabled { opacity: 0.4; cursor: default; }

/* Document table */
.doc-table {
    width: 100%;
    border-collapse: collapse;
}
.doc-table thead th {
    font-size: 11px;
    font-weight: 500;
    color: #999;
    text-transform: none;
    letter-spacing: 0;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}
.doc-table tbody tr {
    cursor: pointer;
    border-bottom: 1px solid #F0F0F0;
    transition: background 0.1s;
}
.doc-table tbody tr:hover {
    background: #FAFBFC;
}
.doc-table tbody td {
    padding: 16px;
    vertical-align: middle;
    min-height: 70px;
}

/* Column widths */
.th-status, .td-status { width: 70px; text-align: center; }
.th-subject, .td-subject { min-width: 300px; }
.th-period, .td-period { width: 200px; white-space: nowrap; }
.th-date, .td-date { width: 160px; white-space: nowrap; font-size: 13px; color: var(--text-secondary); }
.th-recipient, .td-recipient { width: 180px; text-align: right; }
.th-action, .td-action { width: 70px; text-align: center; }

/* Progress circle */
.progress-circle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Subject cell */
.cell-subject {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cell-subject-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.cell-subject-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* From/To badges */
.badge-from {
    display: inline-block;
    background: #9E9E9E;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.3;
}
.badge-to {
    display: inline-block;
    background: #4285F4;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.3;
}
.badge-name {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Contract period */
.contract-period {
    font-size: 13px;
    color: var(--text);
}
.contract-period-unset {
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
}

/* Recipient cell (pending_signing) */
.cell-recipient {
    text-align: right;
}
.cell-recipient-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}
.cell-recipient-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Memo button (completed) */
.btn-memo {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}
.btn-memo:hover { background: #F5F6F8; }
