:root {
    --bg-color: #f1f5f9;
    --text-color: #0f172a;
    --header-bg: #1e293b;
    --header-text: #f8fafc;
    --tile-bg: #ffffff;
    --tile-border: #e2e8f0;
    --tile-hover: #f8fafc;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #22c55e;
    --error-color: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 0;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.org-stats {
    display: flex;
    align-items: center;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    min-width: 140px;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--header-text);
}

.stat-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.25rem;
}

main {
    padding: 2rem 0;
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.section-tile {
    background: var(--tile-bg);
    border: none;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 1px 3px var(--shadow-color);
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: calc(100vw / 3);
    overflow: hidden;
}

/* Make memo section span full width */
.section-tile.memo-section {
    grid-column: 1 / -1;
    padding: 1.5rem;
    height: auto;
    max-height: calc(100vw / 3);
}

.section-tile:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.section-tile:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
}

.member-list,
.asset-list,
.transaction-list,
.memo-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.member-item,
.asset-item,
.transaction-item,
.memo-item {
    display: flex;
    align-items: left;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    background: var(--tile-bg);
    border: none;
    box-shadow: 0 1px 3px var(--shadow-color);
    margin-bottom: 0.5rem;
}

.member-item:last-child,
.asset-item:last-child,
.transaction-item:last-child,
.memo-item:last-child {
    margin-bottom: 0;
}

.member-item:hover,
.asset-item:hover,
.transaction-item:hover,
.memo-item:hover {
    background-color: var(--tile-hover);
    box-shadow: 0 4px 6px var(--shadow-color);
    transform: translateY(-2px);
}

.member-info,
.asset-info,
.transaction-info,
.memo-info {
    flex: 1;
}

.member-name,
.asset-name,
.transaction-type,
.memo-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.member-role,
.asset-details,
.transaction-details,
.memo-content {
    font-size: 0.875rem;
    color: #64748b;
}

.memo-controls {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.add-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-btn:hover {
    background-color: var(--accent-hover);
}

.success {
    color: var(--success-color);
}

.error {
    color: var(--error-color);
}

.memo-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-radius: 8px;
    background-color: var(--tile-bg);
    border: none;
    box-shadow: 0 1px 3px var(--shadow-color);
    transition: all 0.3s ease-in-out;
}

.memo-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: var(--tile-hover);
}

.memo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    width: 100%;
}

.memo-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

.memo-metadata {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #64748b;
    align-items: center;
}

.memo-author {
    font-weight: 500;
    color: var(--accent-color);
}

.memo-date {
    color: #94a3b8;
}

.memo-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #475569;
    white-space: pre-wrap;
}

/* Memo dialog styles */
.memo-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--tile-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--tile-border);
}

.memo-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

.memo-form input,
.memo-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--tile-border);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.memo-form input:focus,
.memo-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.memo-form textarea {
    min-height: 120px;
    resize: vertical;
}

.memo-form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.cancel-btn {
    background-color: #e2e8f0;
    color: #475569;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cancel-btn:hover {
    background-color: #cbd5e1;
}

.submit-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    opacity: 0.9;
}

.submit-btn:hover {
    background-color: var(--accent-hover);
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.transaction-item:hover {
    background-color: var(--tile-hover);
}

.transaction-info {
    flex: 1;
}

.transaction-type {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.transaction-details {
    font-size: 0.875rem;
    color: #64748b;
}

.transaction-amount {
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.amount-positive {
    color: var(--success-color);
    background-color: rgba(34, 197, 94, 0.1);
}

.amount-negative {
    color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Customize scrollbar for webkit browsers */
.member-list::-webkit-scrollbar,
.asset-list::-webkit-scrollbar,
.transaction-list::-webkit-scrollbar,
.memo-list::-webkit-scrollbar {
    width: 6px;
}

.member-list::-webkit-scrollbar-track,
.asset-list::-webkit-scrollbar-track,
.transaction-list::-webkit-scrollbar-track,
.memo-list::-webkit-scrollbar-track {
    background: transparent;
    margin: 0.5rem;
}

.member-list::-webkit-scrollbar-thumb,
.asset-list::-webkit-scrollbar-thumb,
.transaction-list::-webkit-scrollbar-thumb,
.memo-list::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.member-list::-webkit-scrollbar-thumb:hover,
.asset-list::-webkit-scrollbar-thumb:hover,
.transaction-list::-webkit-scrollbar-thumb:hover,
.memo-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}
