/* 管理画面用スタイル - ダークテーマ版 */

/* ============================================
   CSS Variables (カスタムプロパティ)
   ============================================ */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #0d1421;
    --bg-card: #111827;
    --bg-card-hover: #1a2332;
    --bg-input: #1a2332;
    --bg-sidebar: #0d1421;
    --bg-header: #111827;

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --border-color: #1e293b;
    --border-light: #334155;

    --chart-1: #6366f1;
    --chart-2: #8b5cf6;
    --chart-3: #ec4899;
    --chart-4: #14b8a6;
    --chart-5: #f59e0b;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* ============================================
   リセット & ベース
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    font-size: 14px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* ============================================
   ログイン画面
   ============================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    padding: 20px;
}

.login-container {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header h1 i {
    color: var(--accent-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    width: 100%;
    padding: 1rem;
    padding-right: 3rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.password-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.password-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--text-primary);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.login-button {
    width: 100%;
    padding: 1rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
}

.login-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--accent-primary);
}

/* ============================================
   管理画面レイアウト
   ============================================ */
.admin-panel {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* 丸みを帯びたフレーム */
.admin-panel::before {
    content: '';
    position: fixed;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    pointer-events: none;
    z-index: 9999;
}

/* サイドバー */
.admin-sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    z-index: 100;
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.admin-sidebar.collapsed {
    transform: translateX(-262px);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header h2 i {
    color: var(--accent-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

/* Sidebar cards layout */
.sidebar-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-card .card-header {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px dashed rgba(255,255,255,0.04);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* 折りたたみ時のスタイル */
.sidebar-card.collapsed {
    opacity: 0.95;
}
.sidebar-card .card-header::after {
    content: '\25BC';
    float: right;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}
.sidebar-card.collapsed .card-header::after {
    transform: rotate(-90deg);
}

/* サブメニューを折りたたみ可能にする */
.sidebar-nav .nav-item .submenu {
    display: none;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
}
.sidebar-nav .nav-item.open .submenu {
    display: block;
}
.sidebar-nav .submenu-item a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}
.sidebar-nav .submenu-item a:hover,
.sidebar-nav .submenu-item.active a {
    background: rgba(99,102,241,0.06);
    color: var(--text-primary);
}

/* カードが非表示のときにスペースを取らない */
.sidebar-card[style*="display: none"] {
    display: none !important;
}

.sidebar-card ul {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0.25rem 0.25rem 0.25rem;
}

.sidebar-card .nav-item {
    margin: 0.25rem 0.25rem;
}

.sidebar-card .nav-item a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
}

.sidebar-card .nav-item a:hover {
    background: rgba(99,102,241,0.06);
    color: var(--text-primary);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .nav-item {
    margin: 0.25rem 0.75rem;
}

.sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    padding: 0.7rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 0.65rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar-nav .nav-item a:hover,
.sidebar-nav .nav-item.active a {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
}

.sidebar-nav .nav-item.active a {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.sidebar-nav .nav-item a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* ナビゲーションカテゴリ見出し */
.sidebar-nav .nav-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 1rem 1rem 0.5rem;
    letter-spacing: 1px;
    font-weight: 600;
    text-transform: uppercase;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.sidebar-nav .nav-category:first-child {
    border-top: none;
    margin-top: 0;
}

/* 権限別メニュー */
.sidebar-nav .nav-item.owner-only,
.sidebar-nav .nav-item.admin-only,
.sidebar-nav .nav-item.operator-only {
    /* デフォルトは非表示、JSで制御 */
}

.sidebar-nav .nav-category.owner-only,
.sidebar-nav .nav-category.admin-only,
.sidebar-nav .nav-category.operator-only {
    /* デフォルトは非表示、JSで制御 */
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.logout-button {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
}

.logout-button:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.back-to-site {
    display: block;
    text-align: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-to-site:hover {
    color: var(--accent-primary);
}

/* メインコンテンツ */
.admin-main {
    flex: 1;
    margin-left: 262px;
    background: var(--bg-primary);
    min-height: calc(100vh - 24px);
    transition: margin-left 0.3s ease;
    border-radius: 16px;
    margin-top: 0;
    width: calc(100% - 262px);
    max-width: calc(100% - 262px);
    overflow-x: hidden;
    box-sizing: border-box;
}

.admin-main.expanded {
    margin-left: 12px;
    width: calc(100% - 12px);
    max-width: calc(100% - 12px);
}

/* ヘッダー */
.admin-header {
    background: var(--bg-header);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    border-radius: 16px 16px 0 0;
    margin: 12px 12px 0 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.admin-header h1 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

.admin-user {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.admin-user i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

/* コンテンツエリア */
.admin-content {
    padding: 1.25rem;
    margin: 0 12px 12px 12px;
    overflow-x: hidden;
    box-sizing: border-box;
    width: calc(100% - 24px);
}

.content-section {
    display: none;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
    max-width: 100%;
    overflow-x: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ダッシュボード
   ============================================ */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.card-icon {
    width: 50px;
    height: 50px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.card-info h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.card-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.quick-actions,
.recent-templates {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.quick-actions h2,
.recent-templates h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.quick-actions h2 i,
.recent-templates h2 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.recent-templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.recent-templates-header h2 {
    margin-bottom: 0;
}

#dashboard-category-filter {
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    min-width: 180px;
    cursor: pointer;
    color: var(--text-primary);
}

#dashboard-category-filter:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.action-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.action-btn i {
    margin-right: 0.5rem;
}

/* ============================================
   セクションヘッダー & ボタン
   ============================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 100%;
    box-sizing: border-box;
}

.section-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

.section-header h2 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.primary-btn {
    padding: 0.6rem 1.25rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.35);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.primary-btn i {
    margin-right: 0.5rem;
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.secondary-btn i {
    margin-right: 0.5rem;
}

/* ============================================
   テンプレート管理
   ============================================ */
.template-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

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

#category-filter {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    min-width: 200px;
    cursor: pointer;
    color: var(--text-primary);
}

#category-filter:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* テンプレートリスト */
.template-list {
    display: grid;
    gap: 1rem;
}

.template-item {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.template-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(5px);
}

.template-info {
    flex: 1;
}

.template-info h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.template-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.template-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.template-preview-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.template-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.template-actions button {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.use-btn {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.use-btn:hover {
    background: rgba(16, 185, 129, 0.25);
}

.edit-btn {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.edit-btn:hover {
    background: rgba(59, 130, 246, 0.25);
}

.delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ============================================
   設定ページ
   ============================================ */
#settings-section h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

#settings-section h2 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.settings-group {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
}

.settings-group h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-group .form-group {
    margin-bottom: 1rem;
}

.settings-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.settings-group input[type="text"],
.settings-group input[type="password"],
.settings-group input[type="number"] {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
}

.settings-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* 権限設定ページ */
.section-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.permission-group-header {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem 0 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.permission-group-header:first-child {
    margin-top: 0;
}

.permission-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.permission-item label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0;
}

.permission-select {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 140px;
}

.permission-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.permission-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.permission-table th,
.permission-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.permission-table th {
    background: var(--bg-input);
    color: var(--text-primary);
    font-weight: 600;
}

.permission-table td {
    color: var(--text-secondary);
}

.permission-table tr:hover td {
    background: var(--bg-card-hover);
}

/* 集計設定（シンプル版） */
.calc-settings-simple {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.calc-settings-simple .settings-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calc-settings-simple .settings-row label {
    min-width: 140px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.calc-settings-simple .settings-row input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
}

.calc-settings-simple .settings-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* 歩合表示（自動計算・読み取り専用） */
.calc-b-commission-display {
    display: inline-block;
    padding: 0.5rem;
    background: var(--bg-input);
    border-radius: 4px;
    min-width: 60px;
    text-align: right;
    font-weight: 500;
    color: var(--accent-primary);
}

/* 合計表示行 */
.calc-totals-row {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* カテゴリー管理 */
.add-category {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.add-category input {
    flex: 1;
    max-width: 300px;
}

.category-list {
    list-style: none;
    max-width: 400px;
    padding: 0;
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.category-list li button {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.category-list li button:hover {
    color: #f87171;
}

/* データ管理 */
.data-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============================================
   モーダル
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-content.use-modal {
    max-width: 700px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.modal-header h2 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

#template-form {
    padding: 1.5rem;
}

#template-form .form-group {
    margin-bottom: 1.5rem;
}

#template-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#template-form input,
#template-form select,
#template-form textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
}

#template-form input:focus,
#template-form select:focus,
#template-form textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#template-form textarea {
    resize: vertical;
    min-height: 200px;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* テンプレート使用モーダル */
.template-preview {
    padding: 1.5rem;
}

.preview-section {
    margin-bottom: 1.5rem;
}

.preview-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.preview-section-header label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.copy-btn {
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(16, 185, 129, 0.25);
}

.copy-btn i {
    margin-right: 0.3rem;
}

.preview-title-wrapper {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 0.5rem 1rem;
}

.preview-title-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: inherit;
}

.preview-title-wrapper input:focus {
    outline: none;
}

.preview-content-wrapper {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 1rem;
}

.preview-content-wrapper textarea {
    width: 100%;
    min-height: 250px;
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1.8;
    resize: none;
    font-family: inherit;
    color: var(--text-primary);
}

.preview-content-wrapper textarea:focus {
    outline: none;
}

.copy-success {
    text-align: center;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-radius: 8px;
    margin: 0 1.5rem 1.5rem;
}

/* ============================================
   通知
   ============================================ */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--danger);
}

.notification.info {
    background: var(--info);
}

/* ============================================
   集計ページ
   ============================================ */
.calculator-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.calc-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.calc-section h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.calc-section h3 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.calc-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.calc-field label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.calc-field input {
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
}

.calc-field input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.calc-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 集計テーブル */
.calc-table-wrapper {
    overflow-x: auto;
}

.calc-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.calc-table th,
.calc-table td {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.calc-table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.calc-table td {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.calc-table .price-cell {
    font-weight: 600;
    color: var(--accent-primary);
    text-align: left;
}

.calc-table .subtotal-cell,
.calc-table .total-cell {
    font-weight: 500;
    color: var(--text-primary);
}

.calc-table .total-cell {
    color: var(--success);
    font-weight: 600;
}

.calc-table input {
    width: 80px;
    padding: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.calc-table input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* 集計結果 */
.calc-results {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

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

.result-label {
    font-weight: 500;
    font-size: 1rem;
}

.result-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.result-value.highlight {
    font-size: 1.3rem;
    color: #fbbf24;
}

.result-value.highlight-final {
    font-size: 1.5rem;
    color: #34d399;
}

.result-value.highlight-send {
    font-size: 1.3rem;
    color: #f472b6;
}

.expense-row input {
    width: 120px;
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    text-align: right;
    font-size: 1rem;
    background: rgba(255,255,255,0.9);
    color: #333;
}

.expense-row input:focus {
    outline: none;
    background: white;
}

/* 出力プレビュー */
.calc-preview {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1rem;
    overflow-x: auto;
}

.calc-preview pre {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 0;
}

/* ============================================
   サブメニュー
   ============================================ */
.nav-item.has-submenu > a::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.nav-item.has-submenu.open > a::after {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    list-style: none;
    padding: 0.5rem 0 0 0;
    margin: 0;
}

.nav-item.has-submenu.open .submenu {
    display: block;
}

.submenu-item {
    margin: 0;
}

.submenu-item a {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    gap: 0.5rem;
    border-radius: 8px;
    margin: 0.125rem 0.75rem;
}

.submenu-item a:hover,
.submenu-item.active a {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

/* ============================================
   集計ダッシュボード
   ============================================ */
.calc-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.calc-staff-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.calc-staff-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.calc-staff-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.staff-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.staff-card-header i {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.staff-card-header span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.staff-card-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staff-card-stats .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.staff-card-stats .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.staff-card-stats .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* 担当者A/Bセクション */
.calc-section-a {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.calc-section-a h3 {
    color: #38bdf8;
    border-bottom-color: rgba(14, 165, 233, 0.3);
}

.calc-section-b {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.calc-section-b h3 {
    color: #fbbf24;
    border-bottom-color: rgba(245, 158, 11, 0.3);
}

.calc-table-a .a-quantity,
.calc-table-a .a-subtotal {
    font-weight: 600;
    text-align: center;
}

.calc-table-a .a-subtotal {
    color: #38bdf8;
}

/* ============================================
   カレンダーページ
   ============================================ */
.calendar-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.calendar-item {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.calendar-item h3 {
    padding: 1rem 1.5rem;
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
}

.calendar-item h3 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.calendar-iframe-wrapper {
    width: 100%;
    overflow: hidden;
}

.calendar-iframe-wrapper iframe {
    width: 100%;
    min-height: 500px;
    display: block;
}

/* ============================================
   資産管理 - ダッシュボードスタイル
   ============================================ */
/* ============================================
   ポートフォリオ タブ
   ============================================ */
.portfolio-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem;
    background: var(--bg-input);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.portfolio-tab {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.portfolio-tab:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.portfolio-tab.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.portfolio-tab .tab-flag {
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   TopHoldings カード（TopStakingAssets風）
   ============================================ */
.top-holdings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    min-height: 0;
}

.top-holding-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.top-holding-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.top-holding-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.top-holding-card.gold::before {
    background: linear-gradient(90deg, #FFD700, #FFA000);
}

.top-holding-card.silver::before {
    background: linear-gradient(90deg, #C0C0C0, #9E9E9E);
}

.top-holding-card.bronze::before {
    background: linear-gradient(90deg, #CD7F32, #A0522D);
}

.top-holding-rank {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.2rem;
    line-height: 1;
}

.top-holding-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.top-holding-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.top-holding-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.th-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.th-ticker {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.th-currency-tag {
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 1px 4px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 3px;
}

.top-holding-value {
    margin-bottom: 0.5rem;
}

.th-valuation {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.th-valuation-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.top-holding-pnl {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.top-holding-pnl.positive {
    color: var(--success);
}

.top-holding-pnl.negative {
    color: var(--danger);
}

.th-pnl-rate {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.top-holding-pnl.positive .th-pnl-rate {
    background: rgba(16, 185, 129, 0.15);
}

.top-holding-pnl.negative .th-pnl-rate {
    background: rgba(239, 68, 68, 0.15);
}

.top-holdings-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px dashed var(--border-color);
}

.top-holdings-empty i {
    margin-right: 0.5rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .portfolio-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .top-holdings-container {
        grid-template-columns: 1fr;
    }
}

#asset-portfolio-section {
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

#asset-portfolio-section .section-header {
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}

#asset-portfolio-section .section-header > div {
    flex-shrink: 1;
    min-width: 0;
    flex-wrap: wrap !important;
}

.exchange-rate-input {
    flex-shrink: 1;
}

/* ポートフォリオヘッダーのボタンエリア */
#asset-portfolio-section .section-header > div:last-child {
    flex-wrap: wrap !important;
    justify-content: flex-end;
}

#asset-portfolio-section .primary-btn {
    white-space: nowrap;
}

.asset-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
    box-sizing: border-box;
}

/* 資産サマリーカード */
.asset-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.asset-summary-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    min-width: 0;
    box-sizing: border-box;
}

.asset-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.asset-summary-card.total::before {
    background: var(--accent-gradient);
}

.asset-summary-card.investment::before {
    background: linear-gradient(90deg, #10b981, #14b8a6);
}

.asset-summary-card.profit::before {
    background: linear-gradient(90deg, #f59e0b, #f97316);
}

.asset-summary-card.watchlist::before {
    background: linear-gradient(90deg, #ec4899, #f472b6);
}

.asset-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.asset-card-header .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.asset-card-header .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.asset-card-value {
    font-size: clamp(1.1rem, 2.5vw, 1.75rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.asset-card-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.asset-card-change.positive {
    color: var(--success);
}

.asset-card-change.negative {
    color: var(--danger);
}

/* チャートコンテナ */
.chart-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    overflow: visible;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.chart-header h3 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.chart-btn.active,
.chart-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.chart-wrapper {
    height: 300px;
    position: relative;
}

/* 銘柄リスト */
.stock-list {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.stock-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
}

.stock-list-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.stock-list-header h3 i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

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

.stock-table th,
.stock-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.stock-table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-table tr:hover {
    background: var(--bg-card-hover);
}

.stock-table td {
    color: var(--text-primary);
}

.stock-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stock-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.stock-name-text {
    display: flex;
    flex-direction: column;
}

.stock-name-text .symbol {
    font-weight: 600;
}

.stock-name-text .name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stock-price {
    font-weight: 600;
}

.stock-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stock-change.positive {
    color: var(--success);
}

.stock-change.negative {
    color: var(--danger);
}

.stock-actions {
    display: flex;
    gap: 0.5rem;
}

.stock-action-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.stock-action-btn.buy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stock-action-btn.buy:hover {
    background: rgba(16, 185, 129, 0.25);
}

.stock-action-btn.watch {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.stock-action-btn.watch:hover {
    background: rgba(99, 102, 241, 0.25);
}

.stock-action-btn.remove {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stock-action-btn.remove:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* 分配チャート */
.distribution-chart {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.distribution-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.legend-value {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: auto;
}

/* グリッドレイアウト */
.asset-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.asset-grid-full {
    grid-column: 1 / -1;
}

@media (max-width: 1200px) {
    .asset-grid {
        grid-template-columns: 1fr;
    }
}

/* 空状態 */
.empty-portfolio {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-portfolio i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.empty-portfolio h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-portfolio p {
    margin-bottom: 1.5rem;
}

/* 入力モーダル */
.asset-input-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.asset-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.asset-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.asset-input-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.asset-input-group input,
.asset-input-group select {
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.asset-input-group input:focus,
.asset-input-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ============================================
   レスポンシブ
   ============================================ */
@media (max-width: 1024px) {
    .admin-panel {
        padding: 8px;
    }

    .admin-panel::before {
        top: 4px;
        left: 4px;
        right: 4px;
        bottom: 4px;
        border-radius: 16px;
    }

    .admin-sidebar {
        transform: translateX(-262px);
        top: 8px;
        left: 8px;
        bottom: 8px;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 8px;
        width: calc(100% - 8px);
        max-width: calc(100% - 8px);
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-header {
        margin: 8px 8px 0 8px;
    }

    .admin-content {
        margin: 0 8px 8px 8px;
        width: calc(100% - 16px);
    }

    .asset-summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.75rem;
    }

    .asset-summary-card {
        padding: 1rem;
    }

    .asset-card-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .login-container {
        padding: 2rem;
    }

    .admin-content {
        padding: 1rem;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .template-filters {
        flex-direction: column;
    }

    .search-box {
        min-width: auto;
    }

    #category-filter {
        width: 100%;
    }

    .template-item {
        flex-direction: column;
        gap: 1rem;
    }

    .template-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
    }

    .data-actions {
        flex-direction: column;
    }

    .data-actions button {
        width: 100%;
    }

    .asset-summary-cards {
        grid-template-columns: 1fr;
    }

    .distribution-chart {
        flex-direction: column;
    }

    .asset-grid {
        grid-template-columns: 1fr;
    }

    .asset-input-row {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   プロフィールページ
   =========================================== */

.profile-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.profile-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.profile-main-card {
    padding: 1.5rem;
}

.profile-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.profile-identity {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.profile-identity-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.profile-display-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-meta {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.profile-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.profile-period {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.profile-bio {
    flex: 1;
}

.profile-bio .bio-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    font-style: italic;
    margin: 0;
}

.profile-interests {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* プロフィール編集 */
.profile-edit-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-edit-section:first-child {
    padding-top: 0;
}

.profile-edit-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-edit-section h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.profile-edit-grid .form-group {
    margin-bottom: 0;
}

.profile-edit-grid .form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    display: block;
}

.profile-edit-grid .form-group.full-width {
    grid-column: 1 / -1;
}

.profile-image-upload {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.profile-image-preview img {
    width: 110px;
    height: 110px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
}

.profile-image-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-image-actions .help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.icon-list-editor {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin-top: 0.75rem;
}

.icon-list-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.icon-list-controls {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.icon-list-controls .icon-select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
}

.icon-list-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.icon-list-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.icon-list-item img {
    width: 18px;
    height: 18px;
}

.icon-remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.icon-remove-btn:hover {
    color: var(--danger);
}

.profile-icon-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.profile-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.75rem;
}

.profile-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.profile-icon-image {
    width: 28px;
    height: 28px;
}

/* ブランドアイコン - バッジ型 */
.profile-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ブランドアイコン - Font Awesome型 */
.profile-icon-fa {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ブランドアイコン - 絵文字型 */
.profile-icon-emoji {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

/* 編集モーダル内のブランドアイコン */
.icon-list-item .profile-icon-badge,
.icon-list-item .profile-icon-fa,
.icon-list-item .profile-icon-emoji {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.icon-list-item .profile-icon-fa {
    font-size: 0.9rem;
}

.icon-list-item .profile-icon-emoji {
    font-size: 1.1rem;
}

.profile-grid-top .profile-column {
    align-items: stretch;
}

.profile-grid-top .profile-card {
    height: 100%;
}

.profile-distribution .distribution-legend {
    margin-top: 0.75rem;
}

.profile-allocation-card .chart-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem 0;
}

.interests-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.interest-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.interest-tag {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.interest-tag:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.interest-tag i {
    font-size: 0.75rem;
    color: var(--accent-primary);
}

/* プロフィールグリッド */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.profile-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 経歴セクション */
.experience-item,
.education-item {
    width: 100%;
}

.experience-header,
.education-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.experience-title,
.education-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.experience-period,
.education-period {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

.experience-subtitle,
.education-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
}

.education-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.experience-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.experience-list li {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.experience-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

/* ツールセクション */
.tools-section,
.status-section {
    width: 100%;
}

.section-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tools-icons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tool-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.tool-icon:hover {
    transform: scale(1.1);
}

.tool-icon.flag-icon {
    font-size: 1.5rem;
    background: var(--bg-secondary);
}

/* ステータスセクション */
.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-value.active {
    color: var(--success-color);
}

/* ポートフォリオリンク */
.portfolio-links-card {
    padding: 1rem 1.25rem;
}

.portfolio-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.portfolio-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.portfolio-link:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.portfolio-link i {
    font-size: 1rem;
}

/* 連絡先 */
.contact-card {
    padding: 1rem 1.25rem;
}

.contact-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a.contact-item:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.contact-item i {
    font-size: 1rem;
    color: var(--accent-primary);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-identity {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-edit-grid {
        grid-template-columns: 1fr;
    }

    .profile-image-upload {
        flex-direction: column;
        align-items: flex-start;
    }

    .icon-list-controls {
        grid-template-columns: 1fr;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-interests {
        justify-content: center;
    }

    .portfolio-links,
    .contact-details {
        justify-content: center;
    }
}

/* ===========================================
   複数ダッシュボード
   =========================================== */

/* トレード用ダッシュボード */
.trade-dashboard,
.work-dashboard,
.analysis-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.trade-cards .dashboard-card.profit h3 {
    color: var(--success-color);
}

.trade-section,
.work-section,
.analysis-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.trade-section .section-header,
.work-section .section-header,
.analysis-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.trade-section .section-header h3,
.work-section .section-header h3,
.analysis-section .section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.trade-section .section-header h3 i,
.work-section .section-header h3 i,
.analysis-section .section-header h3 i {
    color: var(--accent-primary);
}

/* 市場指標カード */
.market-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.indicator-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.indicator-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.indicator-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.indicator-flag {
    font-size: 1.1rem;
}

.indicator-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.indicator-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.indicator-change {
    font-size: 0.8rem;
    font-weight: 500;
}

.indicator-change.positive {
    color: var(--success-color);
}

.indicator-change.negative {
    color: var(--danger-color);
}

/* クイックウォッチリスト */
.quick-watchlist {
    overflow-x: auto;
}

.stock-table.compact {
    font-size: 0.85rem;
}

.stock-table.compact th,
.stock-table.compact td {
    padding: 0.6rem 0.75rem;
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* 最近のトレード */
.recent-trades .empty-state,
.task-list .empty-state,
#frequent-templates .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    color: var(--text-muted);
}

.recent-trades .empty-state i,
.task-list .empty-state i,
#frequent-templates .empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* 業務用ダッシュボード */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.task-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.task-item label {
    flex: 1;
    color: var(--text-primary);
    cursor: pointer;
}

.task-item .task-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.template-list.compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 担当者サマリー */
.staff-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staff-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

.staff-summary-item .staff-amount {
    color: var(--accent-primary);
    font-weight: 600;
}

/* 分析用ダッシュボード */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-section {
    grid-column: 1 / -1;
}

.chart-wrapper {
    height: 300px;
    position: relative;
}

.chart-wrapper.small {
    height: 200px;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-btn:hover,
.chart-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* 月別パフォーマンス */
.monthly-performance {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.month-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.month-item .month-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.month-item .month-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.month-item.positive .month-value {
    color: var(--success-color);
}

.month-item.negative .month-value {
    color: var(--danger-color);
}

/* 統計グリッド */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-item .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-item .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item .stat-value.positive {
    color: var(--success-color);
}

.stat-item .stat-value.negative {
    color: var(--danger-color);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .market-indicators {
        grid-template-columns: repeat(2, 1fr);
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   多通貨表示（USD/JPY）
   ============================================ */
.secondary-currency {
    display: block;
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 2px;
}

.dual-currency {
    line-height: 1.4;
}

/* 為替レート表示 */
.exchange-rate-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.exchange-rate-display .rate {
    color: var(--text-primary);
    font-weight: 500;
}

.exchange-rate-display .label {
    color: var(--text-muted);
}

/* テーブル内の多通貨表示 */
table .dual-currency .secondary-currency {
    font-size: 0.7em;
}

/* サマリーカード内の多通貨表示 */
.asset-card-value .secondary-currency {
    font-size: 0.6em;
}

/* 前日比表示 */
.asset-card-change .daily-change-amount {
    display: block;
    font-size: 0.7em;
    color: inherit;
    opacity: 0.8;
    margin-top: 2px;
}

.asset-card-change.neutral {
    color: var(--text-muted);
}

.asset-card-change.neutral i {
    color: var(--text-muted);
}

/* ============================================
   TradingView マルチチャートグリッド
   ============================================ */
.multi-chart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem 0;
}

.chart-cell {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 250px;
}

.chart-cell:hover {
    border-color: var(--accent-primary);
}

/* TradingViewウィジェットコンテナ */
.tradingview-widget-container {
    width: 100%;
}

/* 市場指標グリッド（横並びレイアウト） */
.market-indicators-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.market-panel {
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    padding: 0.875rem;
    /* 高さは内容に合わせて自動調整 */
}

.market-panel .section-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.market-panel .section-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

/* トレードダッシュボード 2列2行グリッドレイアウト（画面いっぱい） */
.trade-sections-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.75rem;
    height: calc(100vh - 180px);
    min-height: 600px;
}

.trade-section-panel {
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trade-section-panel .tradingview-widget-container {
    flex: 1;
    min-height: 0;
}

.trade-section-panel .section-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trade-section-panel .section-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.trade-section-panel .section-header h3 i {
    color: var(--accent-primary);
}

.trade-section-panel .edit-panel-btn {
    padding: 0.35rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.trade-section-panel .edit-panel-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.trade-section-panel .tradingview-widget-container {
    width: 100%;
    /* 高さはウィジェット内容に合わせて自動調整 */
}

/* レスポンシブ: 小さい画面では1列に */
@media (max-width: 1200px) {
    .trade-sections-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
}

/* 監視銘柄チャートグリッド */
.watch-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.watch-chart-cell {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 500px;
    height: 500px;
    position: relative;
}

.watch-chart-cell .tradingview-widget-container {
    height: 100% !important;
}

.watch-chart-cell .tradingview-widget-container__widget {
    height: 100% !important;
}

.watch-chart-cell:hover {
    border-color: var(--accent-primary);
}

.watch-chart-cell .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(239, 68, 68, 0.8);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.watch-chart-cell:hover .remove-btn {
    display: flex;
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
    .multi-chart-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .market-indicators-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .multi-chart-grid {
        grid-template-columns: 1fr;
    }

    .watch-chart-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   メニュー並び替え
   ============================================ */
.menu-reorder-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.menu-reorder-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-reorder-item:hover {
    border-color: var(--accent-primary);
}

.menu-reorder-item.dragging {
    opacity: 0.5;
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.menu-reorder-item .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 0.25rem;
}

.menu-reorder-item .drag-handle:active {
    cursor: grabbing;
}

.menu-reorder-item .menu-icon {
    width: 24px;
    text-align: center;
    color: var(--accent-primary);
}

.menu-reorder-item .menu-label {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.menu-reorder-item .reorder-buttons {
    display: flex;
    gap: 0.25rem;
}

.menu-reorder-item .reorder-btn {
    padding: 0.35rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.menu-reorder-item .reorder-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.menu-reorder-item .reorder-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================
   保存済み銘柄ボタン
   ============================================ */
.saved-symbols {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.saved-symbol-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.saved-symbol-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.saved-symbol-btn .symbol-name {
    font-weight: 500;
}

.saved-symbol-btn .symbol-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--danger);
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.saved-symbol-btn .symbol-remove-btn:hover {
    background: var(--danger);
    color: white;
}

/* ============================================
   資料保管庫
   ============================================ */
.storage-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
}

.view-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent-primary);
    color: white;
}

.file-storage-container {
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.file-list-header {
    display: grid;
    grid-template-columns: 2fr 100px 100px 150px 120px;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-list {
    min-height: 300px;
}

.file-item {
    display: grid;
    grid-template-columns: 2fr 100px 100px 150px 120px;
    gap: 1rem;
    padding: 1rem 1.25rem;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
    cursor: pointer;
}

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

.file-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
}

.file-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.file-icon.pdf { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.file-icon.doc { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.file-icon.xls { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.file-icon.img { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.file-icon.txt { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.file-icon.csv { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.file-icon.default { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary); }

/* サムネイル表示 */
.file-thumbnail {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-input);
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* グリッド表示でのサムネイル */
.file-list.grid-view .file-thumbnail {
    width: 80px;
    height: 80px;
    margin-bottom: 0.5rem;
}

.file-type, .file-size, .file-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

.file-action-btn {
    padding: 0.4rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.file-action-btn.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.file-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.file-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.file-empty p {
    margin: 0.25rem 0;
}

.file-empty-hint {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* グリッド表示 */
.file-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.file-list.grid-view .file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-input);
}

.file-list.grid-view .file-item:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-list.grid-view .file-icon {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.file-list.grid-view .file-name {
    flex-direction: column;
    gap: 0.25rem;
}

.file-list.grid-view .file-name span {
    width: 100%;
    font-size: 0.9rem;
}

.file-list.grid-view .file-type,
.file-list.grid-view .file-size,
.file-list.grid-view .file-date {
    display: none;
}

.file-list.grid-view .file-actions {
    margin-top: 0.75rem;
}

.file-list.grid-view .file-empty {
    grid-column: 1 / -1;
}

/* アップロードドロップゾーン */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-dropzone i {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.upload-dropzone p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.dropzone-hint {
    font-size: 0.85rem;
    opacity: 0.7;
}

.upload-btn-label {
    display: inline-block;
    margin-top: 1rem;
    cursor: pointer;
}

.upload-preview {
    margin-top: 1rem;
}

.upload-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.upload-preview-item .file-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.upload-preview-item .file-info {
    flex: 1;
    min-width: 0;
}

.upload-preview-item .file-info .name {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-preview-item .file-info .size {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.upload-preview-item .remove-btn {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
}

/* ゴミ箱リスト */
.trash-list {
    max-height: 400px;
    overflow-y: auto;
}

.trash-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.trash-item .file-icon {
    width: 36px;
    height: 36px;
}

.trash-item .file-info {
    flex: 1;
    min-width: 0;
}

.trash-item .file-info .name {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trash-item .file-info .deleted-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.trash-item .trash-actions {
    display: flex;
    gap: 0.5rem;
}

.danger-btn {
    padding: 0.6rem 1.25rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.danger-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ファイルプレビュー */
.file-preview-content {
    padding: 1rem;
}

.file-preview-content img {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.file-preview-content iframe {
    width: 100%;
    height: 60vh;
    border: none;
    border-radius: 8px;
}

.file-preview-content pre {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.file-preview-unsupported {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.file-preview-unsupported i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* レスポンシブ */
@media (max-width: 1024px) {
    .file-list-header {
        display: none;
    }

    .file-item {
        grid-template-columns: 1fr auto;
    }

    .file-type, .file-size, .file-date {
        display: none;
    }
}

@media (max-width: 768px) {
    .storage-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .view-toggle {
        order: -1;
    }
}

/* ============================================
   プロフィール空状態
   ============================================ */
.profile-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.profile-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.profile-empty p {
    margin: 0.25rem 0;
}
